From: ouv Date: Fri, 28 Oct 2005 06:38:41 +0000 (+0000) Subject: T4.1 - Choise of the Graphic Primitive X-Git-Tag: TG-D5-38-2003_D2005-20-12~121 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aa8b24c5be86a542a035f3af478a7b6d729c3202;p=modules%2Fvisu.git T4.1 - Choise of the Graphic Primitive T4.3 - Production of an AVI Clip T5.1 - Advanced Segmentation --- diff --git a/resources/Vertex_Program_ARB.txt b/resources/Vertex_Program_ARB.txt index 104e9aa8..965b523d 100755 --- a/resources/Vertex_Program_ARB.txt +++ b/resources/Vertex_Program_ARB.txt @@ -1,4 +1,4 @@ -attribute float results; +attribute int mode; attribute float clamp; attribute float geomSize; attribute float minSize; @@ -12,8 +12,8 @@ void main() gl_FrontColor = gl_Color; float size; - if( results == 1 ) - size = minSize + ( maxSize - minSize ) * ( 1 - gl_Color.w / 241.0f ); + if( mode == 0 ) + size = minSize + ( maxSize - minSize ) * ( 1 - gl_Color.w / 241.0f ); else size = geomSize; diff --git a/resources/Visu_SphereSegmentation.png b/resources/Visu_SphereSegmentation.png new file mode 100644 index 00000000..e27ca1ca Binary files /dev/null and b/resources/Visu_SphereSegmentation.png differ diff --git a/resources/Visu_recording_pause.png b/resources/Visu_recording_pause.png new file mode 100644 index 00000000..6f37d3fe Binary files /dev/null and b/resources/Visu_recording_pause.png differ diff --git a/resources/Visu_recording_play.png b/resources/Visu_recording_play.png new file mode 100644 index 00000000..62b82247 Binary files /dev/null and b/resources/Visu_recording_play.png differ diff --git a/resources/Visu_recording_start.png b/resources/Visu_recording_start.png new file mode 100644 index 00000000..aef1bb2f Binary files /dev/null and b/resources/Visu_recording_start.png differ diff --git a/resources/Visu_recording_stop.png b/resources/Visu_recording_stop.png new file mode 100644 index 00000000..c6134cce Binary files /dev/null and b/resources/Visu_recording_stop.png differ diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index b17b622c..eecbf2e2 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -105,6 +105,7 @@ VISU_GaussPtsAct myScalarBarCtrl(VISU_ScalarBarCtrl::New()), myBarVisibility(true), myPickingSettings(NULL), + myInsideCursorSettings(NULL), myCurrentPL(NULL) { if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<(thePipeLine); - myDeviceActor->ShallowCopyPL(aPipeLine); + //myDeviceActor->ShallowCopyPL(aPipeLine); + //myDeviceActor->GetPipeLine()->SetMagnification( aPipeLine->GetMagnification() ); } @@ -425,8 +427,12 @@ VISU_GaussPtsAct void* vtkNotUsed(theCallData)) { if(vtkObject* anObject = reinterpret_cast(theClientData)) - if(VISU_GaussPtsAct* self = dynamic_cast(anObject)) - self->OnInteractorEvent(theEvent); + if(VISU_GaussPtsAct* self = dynamic_cast(anObject)) { + if(theEvent == VISU::UpdateInsideSettingsEvent) + self->UpdateInsideCursorSettings(); + else + self->OnInteractorEvent(theEvent); + } } //------------------------------------------------------------------------- @@ -763,6 +769,50 @@ VISU_GaussPtsAct Update(); } +//---------------------------------------------------------------- +void +VISU_GaussPtsAct +::SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings) +{ + if(myInsideCursorSettings == theInsideCursorSettings) + return; + + if(myInsideCursorSettings) + myInsideCursorSettings->RemoveObserver(myEventCallbackCommand.GetPointer()); + + myInsideCursorSettings = theInsideCursorSettings; + + if(theInsideCursorSettings) + theInsideCursorSettings->AddObserver(VISU::UpdateInsideSettingsEvent, + myEventCallbackCommand.GetPointer(), + myPriority); +} + +void +VISU_GaussPtsAct +::UpdateInsideCursorSettings() +{ + UpdateInsideCursorSettings( myDeviceActor ); +} + +void +VISU_GaussPtsAct +::UpdateInsideCursorSettings( PDeviceActor theActor ) +{ + VISU_GaussPointsPL* aPipeline = theActor->GetPipeLine(); + + aPipeline->SetPrimitiveType( myInsideCursorSettings->GetPrimitiveType() ); + aPipeline->SetClamp( myInsideCursorSettings->GetClamp() ); + aPipeline->SetImageData( myInsideCursorSettings->GetTexture() ); + aPipeline->SetAlphaThreshold( myInsideCursorSettings->GetAlphaThreshold() ); + aPipeline->SetMinSize( myInsideCursorSettings->GetMinSize() ); + aPipeline->SetMaxSize( myInsideCursorSettings->GetMaxSize() ); + aPipeline->SetMagnification( myInsideCursorSettings->GetMagnification() ); + aPipeline->SetMagnificationIncrement( myInsideCursorSettings->GetIncrement() ); + + Update(); +} + //============================================================================== vtkStandardNewMacro(VISU_GaussPtsAct1); @@ -808,7 +858,10 @@ VISU_GaussPtsAct1 VISU_GaussPointsPL* aPipeLine = dynamic_cast(thePipeLine); - myInsideDeviceActor->ShallowCopyPL(aPipeLine); + //myInsideDeviceActor->ShallowCopyPL(aPipeLine); + //myInsideDeviceActor->GetPipeLine()->SetMagnification( aPipeLine->GetMagnification() ); + + myDeviceActor->ShallowCopyPL(aPipeLine); // Restore implicit function if(myWidget){ @@ -931,6 +984,14 @@ VISU_GaussPtsAct1 mySetVisibilitySignal(GetVisibility()); } +//---------------------------------------------------------------- +void +VISU_GaussPtsAct1 +::UpdateInsideCursorSettings() +{ + Superclass::UpdateInsideCursorSettings( myInsideDeviceActor ); +} + //---------------------------------------------------------------- void VISU_GaussPtsAct1 @@ -956,13 +1017,23 @@ VISU_GaussPtsAct1 { VISU_GaussPointsPL* aPipeline = myOutsideDeviceActor->GetPipeLine(); + aPipeline->SetPrimitiveType( myOutsideCursorSettings->GetPrimitiveType() ); aPipeline->SetClamp( myOutsideCursorSettings->GetClamp() ); aPipeline->SetImageData( myOutsideCursorSettings->GetTexture() ); aPipeline->SetAlphaThreshold( myOutsideCursorSettings->GetAlphaThreshold() ); aPipeline->SetSize( myOutsideCursorSettings->GetSize() ); - myOutsideDeviceActor->GetPSMapper()->SetPointSpriteResults(false); - myOutsideDeviceActor->GetProperty()->SetColor(myOutsideCursorSettings->GetColor()); + if( myOutsideCursorSettings->GetUniform() ) + { + myOutsideDeviceActor->GetPSMapper()->SetPointSpriteMode( 1 ); // Geometry mode + myOutsideDeviceActor->GetProperty()->SetColor( myOutsideCursorSettings->GetColor() ); + } + else + { + myOutsideDeviceActor->GetPSMapper()->SetPointSpriteMode( 2 ); // Outside cursor mode + myOutsideDeviceActor->GetPSMapper()->SetColorModeToMapScalars(); + myOutsideDeviceActor->GetPSMapper()->ScalarVisibilityOn(); + } Update(); } diff --git a/src/OBJECT/VISU_GaussPtsAct.h b/src/OBJECT/VISU_GaussPtsAct.h index 05accb6e..3dd4f163 100644 --- a/src/OBJECT/VISU_GaussPtsAct.h +++ b/src/OBJECT/VISU_GaussPtsAct.h @@ -60,6 +60,7 @@ class vtkCallbackCommand; class VISU_ScalarBarCtrl; class VISU_PickingSettings; +class VISU_InsideCursorSettings; class VISU_OutsideCursorSettings; @@ -169,6 +170,16 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor SVTK_SelectionEvent* theSelectionEvent, bool theIsHighlight); + //---------------------------------------------------------------------------- + void + SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings); + + virtual void + UpdateInsideCursorSettings(); + + virtual void + UpdateInsideCursorSettings( PDeviceActor ); + //---------------------------------------------------------------------------- void SetPickingSettings(VISU_PickingSettings* thePickingSettings); @@ -235,6 +246,7 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor bool myBarVisibility; vtkSmartPointer myScalarBarCtrl; + VISU_InsideCursorSettings* myInsideCursorSettings; VISU_PickingSettings* myPickingSettings; }; @@ -264,6 +276,10 @@ class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct void Connect(VISU_GaussPtsAct2* theActor); + //---------------------------------------------------------------------------- + virtual void + UpdateInsideCursorSettings(); + //---------------------------------------------------------------------------- void SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings); diff --git a/src/OBJECT/VISU_GaussPtsSettings.cxx b/src/OBJECT/VISU_GaussPtsSettings.cxx index f60ae626..b0b36ab6 100644 --- a/src/OBJECT/VISU_GaussPtsSettings.cxx +++ b/src/OBJECT/VISU_GaussPtsSettings.cxx @@ -32,18 +32,41 @@ #include //---------------------------------------------------------------- +vtkStandardNewMacro( VISU_InsideCursorSettings ); vtkStandardNewMacro( VISU_OutsideCursorSettings ); vtkStandardNewMacro( VISU_PickingSettings ); +//---------------------------------------------------------------- +VISU_InsideCursorSettings::VISU_InsideCursorSettings() +{ + this->Initial = true; + + this->PrimitiveType = -1; + this->Clamp = -1; + this->Texture = NULL; + this->AlphaThreshold = -1; + this->MinSize = -1; + this->MaxSize = -1; + this->Magnification = -1; + this->Increment = -1; +} + +VISU_InsideCursorSettings::~VISU_InsideCursorSettings() +{ + this->SetTexture( NULL ); +} + //---------------------------------------------------------------- VISU_OutsideCursorSettings::VISU_OutsideCursorSettings() { this->Initial = true; + this->PrimitiveType = -1; this->Clamp = -1; this->Texture = NULL; this->AlphaThreshold = -1; this->Size = -1; + this->Uniform = false; this->Color[0] = -1; this->Color[1] = -1; this->Color[1] = -1; diff --git a/src/OBJECT/VISU_GaussPtsSettings.h b/src/OBJECT/VISU_GaussPtsSettings.h index e7618d79..12f241f9 100644 --- a/src/OBJECT/VISU_GaussPtsSettings.h +++ b/src/OBJECT/VISU_GaussPtsSettings.h @@ -38,10 +38,68 @@ class vtkImageData; //============================================================================ namespace VISU { - const vtkIdType UpdateOutsideSettingsEvent = vtkCommand::UserEvent + 100; - const vtkIdType UpdatePickingSettingsEvent = vtkCommand::UserEvent + 200; + const vtkIdType UpdateInsideSettingsEvent = vtkCommand::UserEvent + 100; + const vtkIdType UpdateOutsideSettingsEvent = vtkCommand::UserEvent + 200; + const vtkIdType UpdatePickingSettingsEvent = vtkCommand::UserEvent + 300; } + +//============================================================================ +class VISU_InsideCursorSettings : public vtkObject +{ + public: + vtkTypeMacro( VISU_InsideCursorSettings, vtkObject ); + + VISU_InsideCursorSettings(); + virtual ~VISU_InsideCursorSettings(); + + static + VISU_InsideCursorSettings* + New(); + + vtkSetMacro( Initial, bool ); + vtkGetMacro( Initial, bool ); + + vtkSetMacro( PrimitiveType, int ); + vtkGetMacro( PrimitiveType, int ); + + vtkSetMacro( Clamp, float ); + vtkGetMacro( Clamp, float ); + + vtkSetMacro( Texture, vtkImageData* ); + vtkGetMacro( Texture, vtkImageData* ); + + vtkSetMacro( AlphaThreshold, float ); + vtkGetMacro( AlphaThreshold, float ); + + vtkSetMacro( MinSize, float ); + vtkGetMacro( MinSize, float ); + + vtkSetMacro( MaxSize, float ); + vtkGetMacro( MaxSize, float ); + + vtkSetMacro( Magnification, float ); + vtkGetMacro( Magnification, float ); + + vtkSetMacro( Increment, float ); + vtkGetMacro( Increment, float ); + + +private: + bool Initial; + + int PrimitiveType; + float Clamp; + vtkImageData* Texture; + float AlphaThreshold; + float MinSize; + float MaxSize; + float Magnification; + float Increment; +}; + + +//============================================================================ class VISU_OutsideCursorSettings : public vtkObject { public: @@ -57,6 +115,9 @@ class VISU_OutsideCursorSettings : public vtkObject vtkSetMacro( Initial, bool ); vtkGetMacro( Initial, bool ); + vtkSetMacro( PrimitiveType, int ); + vtkGetMacro( PrimitiveType, int ); + vtkSetMacro( Clamp, float ); vtkGetMacro( Clamp, float ); @@ -69,16 +130,21 @@ class VISU_OutsideCursorSettings : public vtkObject vtkSetMacro( Size, float ); vtkGetMacro( Size, float ); + vtkSetMacro( Uniform, bool ); + vtkGetMacro( Uniform, bool ); + vtkSetVector3Macro( Color, float ); vtkGetVector3Macro( Color, float ); private: bool Initial; + int PrimitiveType; float Clamp; vtkImageData* Texture; float AlphaThreshold; float Size; + bool Uniform; float Color[3]; }; diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index caf88531..bd753a1e 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -45,6 +45,7 @@ vtkStandardNewMacro(VISU_GaussPointsPL); //---------------------------------------------------------------------------- VISU_GaussPointsPL ::VISU_GaussPointsPL(): + myPrimitiveType(0), myClamp(200.0), mySize(10), myMinSize(3), @@ -73,6 +74,7 @@ VISU_GaussPointsPL myPSMapper->SetInput(aDatsSet); SetGaussPtsIDMapper(aPipeLine->GetGaussPtsIDMapper()); + SetPrimitiveType(aPipeLine->GetPrimitiveType()); SetClamp(aPipeLine->GetClamp()); SetSize(aPipeLine->GetSize()); SetMinSize(aPipeLine->GetMinSize()); @@ -211,7 +213,18 @@ void VISU_GaussPointsPL ::SetIsColored(bool theIsColored) { - myPSMapper->SetPointSpriteResults( theIsColored ); + myPSMapper->SetPointSpriteMode( theIsColored ? 0 : 1 ); // Results / Geometry +} + +//---------------------------------------------------------------------------- +void +VISU_GaussPointsPL +::SetPrimitiveType(int thePrimitiveType) +{ + myPrimitiveType = thePrimitiveType; + myPSMapper->SetPointSpritePrimitiveType( thePrimitiveType ); + + Modified(); } //---------------------------------------------------------------------------- diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index dd8f4ea8..bbc8ac04 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -88,6 +88,12 @@ public: void SetIsColored(bool theIsColored); + void + SetPrimitiveType(int thePrimitiveType); + + int + GetPrimitiveType() { return myPrimitiveType; } + float GetMaximumSupportedSize(); @@ -163,6 +169,7 @@ protected: float myDeltaScalarRange; float myAverageCellSize; + int myPrimitiveType; float myClamp; float mySize; float myMinSize; diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 0709a853..d233a28b 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -45,7 +45,7 @@ #include #include -#include +//#include //#include #include @@ -134,7 +134,9 @@ VISU_OpenGLPointSpriteMapper::VISU_OpenGLPointSpriteMapper() this->UseTextures = true; this->UseShader = true; - this->PointSpriteResults = true; + this->PointSpriteMode = 0; + + this->PointSpritePrimitiveType = 0; this->PointSpriteClamp = 100.0; this->PointSpriteSize = 0.0; @@ -173,8 +175,9 @@ void VISU_OpenGLPointSpriteMapper::ShallowCopy( vtkAbstractMapper* mapper ) VISU_OpenGLPointSpriteMapper* m = VISU_OpenGLPointSpriteMapper::SafeDownCast(mapper); if( m != NULL ) { - this->SetPointSpriteResults( m->GetPointSpriteResults() ); + this->SetPointSpriteMode( m->GetPointSpriteMode() ); + this->SetPointSpritePrimitiveType( m->GetPointSpritePrimitiveType() ); this->SetPointSpriteClamp( m->GetPointSpriteClamp() ); this->SetPointSpriteSize( m->GetPointSpriteSize() ); this->SetPointSpriteMinSize( m->GetPointSpriteMinSize() ); @@ -311,19 +314,23 @@ void VISU_OpenGLPointSpriteMapper::SetShaderVariable( const char* variable, floa } #endif //----------------------------------------------------------------------------- -void VISU_OpenGLPointSpriteMapper::SetPointSpriteResults( bool theResults ) +void VISU_OpenGLPointSpriteMapper::SetPointSpriteMode( int theMode ) { - float aResults = theResults ? 1.0 : 0.0; - - //cout << "SetPointSpriteResults " << this << " " << aResults << endl; + //cout << "SetPointSpriteMode " << this << " " << aMode << endl; - this->PointSpriteResults = theResults; + this->PointSpriteMode = theMode; //#ifdef GL_ARB_shader_objects - //this->SetShaderVariable( "results", theMagnification ); + //this->SetShaderVariable( "mode", theMode ); //#endif this->Modified(); } //----------------------------------------------------------------------------- +void VISU_OpenGLPointSpriteMapper::SetPointSpritePrimitiveType( int thePrimitiveType ) +{ + this->PointSpritePrimitiveType = thePrimitiveType; + this->Modified(); +} +//----------------------------------------------------------------------------- void VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp( float theClamp ) { this->PointSpriteClamp = theClamp; @@ -415,7 +422,7 @@ void VISU_OpenGLPointSpriteMapper::InitExtensions() // (PFNGLUSEPROGRAMOBJECTARBPROC)dlsym( this->OpenGLLibrary, "glUseProgramObjectARB" ); //glUseProgramObjectARB( VISU_OpenGLPointSpriteMapper::VertexProgram ); /* - this->SetShaderVariable( "results", this->PointSpriteResults ); + this->SetShaderVariable( "mode", this->PointSpriteMode ); this->SetShaderVariable( "clamp", this->PointSpriteClamp ); this->SetShaderVariable( "geomSize", this->PointSpriteSize ); this->SetShaderVariable( "minSize", this->PointSpriteMinSize ); @@ -489,7 +496,7 @@ void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act) this->MapScalars(this->ActorOpacity); // Initializing the texture for Point Sprites - if( this->UseTextures ) + if( this->UseTextures && this->PointSpritePrimitiveType == 0 ) this->InitTextures(); // @@ -582,7 +589,6 @@ void VISU_OpenGLPointSpriteMapper::InitPointSprites( vtkRenderer* theRenderer, v glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE ); - //cout << this << " THRESHOLD " << this->PointSpriteAlphaThreshold << endl; glEnable( GL_ALPHA_TEST ); glAlphaFunc( GL_GREATER, this->PointSpriteAlphaThreshold ); break; @@ -593,6 +599,9 @@ void VISU_OpenGLPointSpriteMapper::InitPointSprites( vtkRenderer* theRenderer, v glDepthFunc( GL_LEQUAL ); glEnable( GL_DEPTH_TEST ); + glEnable( GL_ALPHA_TEST ); + glAlphaFunc( GL_GREATER, this->PointSpriteAlphaThreshold ); + glDisable( GL_BLEND ); break; } @@ -809,7 +818,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx, glUseProgramObjectARB( myVertexProgram ); - this->SetShaderVariable( "results", this->PointSpriteResults ); + this->SetShaderVariable( "mode", this->PointSpriteMode ); this->SetShaderVariable( "clamp", this->PointSpriteClamp ); this->SetShaderVariable( "geomSize", this->PointSpriteSize ); this->SetShaderVariable( "minSize", this->PointSpriteMinSize ); @@ -834,7 +843,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx, aVertex[i].vz = p->GetPoint( pts[0] )[2]; float red, green, blue; - if( colors && this->PointSpriteResults ) + if( colors && this->PointSpriteMode != 1 ) { unsigned char *col = colors->GetPointer(pts[0]<< 2); red = ( ( int )col[0] ) / 255.0; @@ -894,6 +903,8 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(int idx, // Draw method for OpenGL. int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *aren, vtkActor *act) { + //cout << "VISU_OpenGLPointSpriteMapper::Draw" << endl; + if( this->UseOpenGLMapper ) return MAPPER_SUPERCLASS::Draw( aren, act ); diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx index 5d624624..a74df39c 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx @@ -153,9 +153,16 @@ public: // Description: // Point Sprite drawing mode - // (Results - multicolor, Geometry - fixed color) - vtkGetMacro(PointSpriteResults, bool); - void SetPointSpriteResults( bool ); + // 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 ); // Description: // Point Sprite size parameters @@ -228,8 +235,9 @@ protected: GLhandleARB myVertexProgram; #endif - bool PointSpriteResults; + int PointSpriteMode; + int PointSpritePrimitiveType; float PointSpriteClamp; float PointSpriteSize; float PointSpriteMinSize; diff --git a/src/VISUGUI/VISUM_images.po b/src/VISUGUI/VISUM_images.po index 23082cd6..24d00e85 100644 --- a/src/VISUGUI/VISUM_images.po +++ b/src/VISUGUI/VISUM_images.po @@ -48,5 +48,20 @@ msgstr "Visu_points.png" msgid "ICON_VVTK_PLANE_SEGMENTATION_SWITCH" msgstr "Visu_PlaneSegmentation.png" +msgid "ICON_VVTK_SPHERE_SEGMENTATION_SWITCH" +msgstr "Visu_SphereSegmentation.png" + +msgid "ICON_VVTK_RECORDING_START" +msgstr "Visu_recording_start.png" + +msgid "ICON_VVTK_RECORDING_PLAY" +msgstr "Visu_recording_play.png" + +msgid "ICON_VVTK_RECORDING_PAUSE" +msgstr "Visu_recording_pause.png" + +msgid "ICON_VVTK_RECORDING_STOP" +msgstr "Visu_recording_stop.png" + msgid "ICON_LOAD_TEXTURE" msgstr "Visu_load_texture.png" diff --git a/src/VISUGUI/VISUM_msg_en.po b/src/VISUGUI/VISUM_msg_en.po index 303fb4c1..7a2e945b 100644 --- a/src/VISUGUI/VISUM_msg_en.po +++ b/src/VISUGUI/VISUM_msg_en.po @@ -25,6 +25,18 @@ msgstr "Gauss Points" msgid "VisuGUI_Module::VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" msgstr "Primitive" +msgid "VisuGUI_Module::VISU_GAUSS_PREF_PRIMITIVE_TYPE" +msgstr "Primitive Type" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_POINTSPRITE" +msgstr "Point sprite" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_OPENGLPOINT" +msgstr "OpenGL point" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_GEOMSPHERE" +msgstr "Geometrical sphere" + msgid "VisuGUI_Module::VISU_GAUSS_PREF_CLAMP" msgstr "Maximum Size (Clamp)" @@ -94,6 +106,12 @@ msgstr "Spacing" msgid "VisuGUI_Module::VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" msgstr "Outside Cursor Gauss Points" +msgid "VisuGUI_Module::VISU_GAUSS_PREF_UNIFORM_COLOR" +msgstr "Uniform Color" + +msgid "VisuGUI_Module::VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" +msgstr "Inside Cursor Gauss Points" + msgid "VisuGUI_Module::VISU_GAUSS_PREF_COLOR_GROUP_TTL" msgstr "Color" @@ -226,6 +244,30 @@ msgstr "Gauss Points Properties" msgid "VVTK_ViewManager::VTK_VIEW_TITLE" msgstr "VISU scene:%1 - viewer:%2" +msgid "VVTK_MainWindow::MNU_VVTK_RECORDING_START" +msgstr "Start recording" + +msgid "VVTK_MainWindow::DSC_VVTK_RECORDING_START" +msgstr "Start recording" + +msgid "VVTK_MainWindow::MNU_VVTK_RECORDING_PLAY" +msgstr "Play recording" + +msgid "VVTK_MainWindow::DSC_VVTK_RECORDING_PLAY" +msgstr "Play recording" + +msgid "VVTK_MainWindow::MNU_VVTK_RECORDING_PAUSE" +msgstr "Pause recording" + +msgid "VVTK_MainWindow::DSC_VVTK_RECORDING_PAUSE" +msgstr "Pause recording" + +msgid "VVTK_MainWindow::MNU_VVTK_RECORDING_STOP" +msgstr "Stop recording" + +msgid "VVTK_MainWindow::DSC_VVTK_RECORDING_STOP" +msgstr "Stop recording" + msgid "VVTK_MainWindow1::MNU_VVTK_INTERACTOR_STYLE_SWITCH" msgstr "Interaction Style Switch" @@ -244,78 +286,90 @@ msgstr "Plane Segmentation Switch" msgid "VVTK_MainWindow1::DSC_VVTK_PLANE_SEGMENTATION_SWITCH" msgstr "Plane Segmentation Switch" -msgid "VisuGUI_GaussPointsDlg::&Cancel" -msgstr "" +msgid "VVTK_MainWindow1::MNU_VVTK_SPHERE_SEGMENTATION_SWITCH" +msgstr "Sphere Segmentation Switch" -msgid "VisuGUI_GaussPointsDlg::&OK" -msgstr "" +msgid "VVTK_MainWindow1::DSC_VVTK_SPHERE_SEGMENTATION_SWITCH" +msgstr "Sphere Segmentation Switch" -msgid "VisuGUI_GaussPointsDlg::DLG_TITLE" -msgstr "Gauss Points" - -msgid "VisuGUI_GaussPointsDlg::GAUSS_POINTS_TAB" -msgstr "Gauss Points" - -msgid "VisuGUI_GaussPointsDlg::SCALAR_BAR_TAB" -msgstr "Scalar Bar" - -msgid "VisuGUI_GaussPointsDlg::PRS_TITLE" -msgstr "Presentation" - -msgid "VisuGUI_GaussPointsDlg::RESULTS" -msgstr "Results" - -msgid "VisuGUI_GaussPointsDlg::GEOMETRY" -msgstr "Geometry" - -msgid "VisuGUI_GaussPointsDlg::PRIMITIVE_TITLE" +msgid "VVTK_PrimitiveBox::PRIMITIVE_TITLE" msgstr "Primitive" -msgid "VisuGUI_GaussPointsDlg::POINT_SPRITE" +msgid "VVTK_PrimitiveBox::POINT_SPRITE" msgstr "Point Sprite" -msgid "VisuGUI_GaussPointsDlg::OPENGL_POINT" +msgid "VVTK_PrimitiveBox::OPENGL_POINT" msgstr "OpenGL Point" -msgid "VisuGUI_GaussPointsDlg::GEOMETRICAL_SPHERE" +msgid "VVTK_PrimitiveBox::GEOMETRICAL_SPHERE" msgstr "Geometrical Sphere" -msgid "VisuGUI_GaussPointsDlg::MAXIMUM_SIZE" +msgid "VVTK_PrimitiveBox::CLAMP" msgstr "Maximum Size (Clamp) : " -msgid "VisuGUI_GaussPointsDlg::MAIN_TEXTURE" +msgid "VVTK_PrimitiveBox::MAIN_TEXTURE" msgstr "Main Texture (16x16) : " -msgid "VisuGUI_GaussPointsDlg::ALPHA_TEXTURE" +msgid "VVTK_PrimitiveBox::ALPHA_TEXTURE" msgstr "Alpha Channel Texture (16x16) : " -msgid "VisuGUI_GaussPointsDlg::ALPHA_THRESHOLD" +msgid "VVTK_PrimitiveBox::ALPHA_THRESHOLD" msgstr "Alpha Channel Threshold : " -msgid "VisuGUI_GaussPointsDlg::SIZE_TITLE" +msgid "VVTK_SizeBox::SIZE_TITLE" msgstr "Size" -msgid "VisuGUI_GaussPointsDlg::SIZE" +msgid "VVTK_SizeBox::OUTSIDE_SIZE" +msgstr "Percentage of normal size(%) : " + +msgid "VVTK_SizeBox::GEOM_SIZE" msgstr "Size of points (%) : " -msgid "VisuGUI_GaussPointsDlg::MIN_SIZE" +msgid "VVTK_SizeBox::MIN_SIZE" msgstr "Range values for min size (%) : " -msgid "VisuGUI_GaussPointsDlg::MAX_SIZE" +msgid "VVTK_SizeBox::MAX_SIZE" msgstr "max size (%) : " -msgid "VisuGUI_GaussPointsDlg::MAGNIFICATION" +msgid "VVTK_SizeBox::MAGNIFICATION" msgstr "Magnification (%) : " -msgid "VisuGUI_GaussPointsDlg::INCREMENT" +msgid "VVTK_SizeBox::INCREMENT" msgstr "+/- Ratio : " -msgid "VisuGUI_GaussPointsDlg::COLOR_TITLE" +msgid "VVTK_SizeBox::COLOR_TITLE" msgstr "Color" -msgid "VisuGUI_GaussPointsDlg::COLOR" +msgid "VVTK_SizeBox::UNIFORM_COLOR" +msgstr "Uniform Color" + +msgid "VVTK_SizeBox::COLOR" msgstr "Color : " +msgid "VisuGUI_GaussPointsDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_GaussPointsDlg::&OK" +msgstr "" + +msgid "VisuGUI_GaussPointsDlg::DLG_TITLE" +msgstr "Gauss Points" + +msgid "VisuGUI_GaussPointsDlg::GAUSS_POINTS_TAB" +msgstr "Gauss Points" + +msgid "VisuGUI_GaussPointsDlg::SCALAR_BAR_TAB" +msgstr "Scalar Bar" + +msgid "VisuGUI_GaussPointsDlg::PRS_TITLE" +msgstr "Presentation" + +msgid "VisuGUI_GaussPointsDlg::RESULTS" +msgstr "Results" + +msgid "VisuGUI_GaussPointsDlg::GEOMETRY" +msgstr "Geometry" + msgid "VisuGUI_GaussScalarBarPane::ACTIVE_BAR_GRP" msgstr "Active bar" @@ -430,47 +484,26 @@ msgstr "Depth" msgid "VVTK_SegmentationCursorDlg::DEPTH" msgstr "Depth of the cursor: " -msgid "VVTK_SegmentationCursorDlg::SEGMENTATION_CURSOR_TAB" -msgstr "Segmentation Cursor" +msgid "VVTK_SegmentationCursorDlg::RADIUS_TITLE" +msgstr "Radius" -msgid "VVTK_SegmentationCursorDlg::PRIMITIVE_TITLE" -msgstr "Primitive" +msgid "VVTK_SegmentationCursorDlg::RADIUS" +msgstr "Radius of the cursor :" -msgid "VVTK_SegmentationCursorDlg::POINT_SPRITE" -msgstr "Point Sprite" - -msgid "VVTK_SegmentationCursorDlg::OPENGL_POINT" -msgstr "OpenGL Point" - -msgid "VVTK_SegmentationCursorDlg::GEOMETRICAL_SPHERE" -msgstr "Geometrical Sphere" - -msgid "VVTK_SegmentationCursorDlg::MAXIMUM_SIZE" -msgstr "Maximum Size (Clamp) : " - -msgid "VVTK_SegmentationCursorDlg::MAIN_TEXTURE" -msgstr "Main Texture (16x16) : " - -msgid "VVTK_SegmentationCursorDlg::ALPHA_TEXTURE" -msgstr "Alpha Channel Texture (16x16) : " +msgid "VVTK_SegmentationCursorDlg::RATIO" +msgstr "+/- Ratio :" -msgid "VVTK_SegmentationCursorDlg::ALPHA_THRESHOLD" -msgstr "Alpha Channel Threshold : " - -msgid "VVTK_SegmentationCursorDlg::SIZE_TITLE" -msgstr "Size" - -msgid "VVTK_SegmentationCursorDlg::SIZE" -msgstr "Percentage of normal size (%) : " +msgid "VVTK_SegmentationCursorDlg::SEGMENTATION_CURSOR_TAB" +msgstr "Segmentation Cursor" -msgid "VVTK_SegmentationCursorDlg::COLOR_TITLE" -msgstr "Color" +msgid "VVTK_SegmentationCursorDlg::GAUSS_POINTS_TAB" +msgstr "Gauss Points" -msgid "VVTK_SegmentationCursorDlg::COLOR" -msgstr "Color : " +msgid "VVTK_SegmentationCursorDlg::INSIDE_GAUSS_POINTS" +msgstr "Inside Cursor Gauss Points Presentation" -msgid "VVTK_SegmentationCursorDlg::OUTSIDE_CURSOR_TAB" -msgstr "Outside Cursor Gauss Points" +msgid "VVTK_SegmentationCursorDlg::OUTSIDE_GAUSS_POINTS" +msgstr "Outside Cursor Gauss Points Presentation" msgid "VVTK_PickingDlg::PICKING_DLG_TITLE" msgstr "Picking" diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index cb16e78e..898d296c 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -35,6 +35,9 @@ #include "VISU_GaussPointsPL.hxx" #include "VISU_Convertor.hxx" +#include "VVTK_PrimitiveBox.h" +#include "VVTK_SizeBox.h" + #include "SalomeApp_Application.h" #include "SalomeApp_Module.h" #include "SUIT_Desktop.h" @@ -519,151 +522,13 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool aBox->setSpacing(6); // Primitive - QGroupBox* PrimitiveGroup = new QGroupBox ( tr( "PRIMITIVE_TITLE" ), aBox, "PrimitiveGroup" ); - PrimitiveGroup->setColumnLayout(0, Qt::Vertical ); - PrimitiveGroup->layout()->setSpacing( 0 ); - PrimitiveGroup->layout()->setMargin( 0 ); - - QGridLayout* PrimitiveGroupLayout = new QGridLayout (PrimitiveGroup->layout()); - PrimitiveGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - PrimitiveGroupLayout->setSpacing(6); - PrimitiveGroupLayout->setMargin(11); - - // Primitive Type - QButtonGroup* aPrimitiveTypeGroup = new QButtonGroup( 3, Qt::Horizontal, PrimitiveGroup, "PrimitiveTypeGroup" ); - aPrimitiveTypeGroup->setRadioButtonExclusive( true ); - aPrimitiveTypeGroup->setFrameStyle( QFrame::NoFrame ); - aPrimitiveTypeGroup->layout()->setMargin( 0 ); - - QRadioButton* aPointSpriteButton = new QRadioButton( tr( "POINT_SPRITE" ), aPrimitiveTypeGroup ); - aPointSpriteButton->setChecked( true ); - - QRadioButton* anOpenGLPointButton = new QRadioButton( tr( "OPENGL_POINT" ), aPrimitiveTypeGroup ); - anOpenGLPointButton->setEnabled( false ); - - QRadioButton* aGeometricalSphereButton = new QRadioButton( tr( "GEOMETRICAL_SPHERE" ), aPrimitiveTypeGroup ); - aGeometricalSphereButton->setEnabled( false ); - - PrimitiveGroupLayout->addMultiCellWidget( aPrimitiveTypeGroup, 0, 0, 0, 2 ); - - // Clamp - QLabel* aClampLabel = new QLabel( tr( "MAXIMUM_SIZE" ), PrimitiveGroup ); - myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, PrimitiveGroup ); - myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - PrimitiveGroupLayout->addWidget( aClampLabel, 1, 0 ); - PrimitiveGroupLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 ); - - // Main Texture - QLabel* aMainTextureLabel = new QLabel( tr( "MAIN_TEXTURE" ), PrimitiveGroup ); - myMainTextureLineEdit = new QLineEdit( PrimitiveGroup ); - QPushButton* aMainTextureButton = new QPushButton( PrimitiveGroup ); - aMainTextureButton->setAutoDefault( false ); - aMainTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) ); - connect( aMainTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseMainTexture() ) ); - - PrimitiveGroupLayout->addWidget( aMainTextureLabel, 2, 0 ); - PrimitiveGroupLayout->addWidget( myMainTextureLineEdit, 2, 1 ); - PrimitiveGroupLayout->addWidget( aMainTextureButton, 2, 2 ); - - // Alpha Texture - QLabel* aAlphaTextureLabel = new QLabel( tr( "ALPHA_TEXTURE" ), PrimitiveGroup ); - myAlphaTextureLineEdit = new QLineEdit( PrimitiveGroup ); - QPushButton* aAlphaTextureButton = new QPushButton( PrimitiveGroup ); - aAlphaTextureButton->setAutoDefault( false ); - aAlphaTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) ); - connect( aAlphaTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseAlphaTexture() ) ); - - PrimitiveGroupLayout->addWidget( aAlphaTextureLabel, 3, 0 ); - PrimitiveGroupLayout->addWidget( myAlphaTextureLineEdit, 3, 1 ); - PrimitiveGroupLayout->addWidget( aAlphaTextureButton, 3, 2 ); - - // Alpha Threshold - QLabel* aAlphaThresholdLabel = new QLabel( tr( "ALPHA_THRESHOLD" ), PrimitiveGroup ); - myAlphaThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, PrimitiveGroup ); - myAlphaThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - PrimitiveGroupLayout->addWidget( aAlphaThresholdLabel, 4, 0 ); - PrimitiveGroupLayout->addMultiCellWidget( myAlphaThresholdSpinBox, 4, 4, 1, 2 ); + myPrimitiveBox = new VVTK_PrimitiveBox( aBox ); // Size - QGroupBox* SizeGroup = new QGroupBox ( tr( "SIZE_TITLE" ), aBox, "SizeGroup" ); - SizeGroup->setColumnLayout(0, Qt::Vertical ); - SizeGroup->layout()->setSpacing( 0 ); - SizeGroup->layout()->setMargin( 0 ); - - QGridLayout* SizeGroupLayout = new QGridLayout (SizeGroup->layout()); - SizeGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - SizeGroupLayout->setSpacing(6); - SizeGroupLayout->setMargin(11); - - // Geometry Size - mySizeLabel = new QLabel( tr( "SIZE" ), SizeGroup ); - mySizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); - mySizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - SizeGroupLayout->addWidget( mySizeLabel, 0, 0 ); - SizeGroupLayout->addWidget( mySizeSpinBox, 0, 1 ); - - // Min Size - myMinSizeLabel = new QLabel( tr( "MIN_SIZE" ), SizeGroup ); - myMinSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); - myMinSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - SizeGroupLayout->addWidget( myMinSizeLabel, 1, 0 ); - SizeGroupLayout->addWidget( myMinSizeSpinBox, 1, 1 ); - - // Max Size - myMaxSizeLabel = new QLabel( tr( "MAX_SIZE" ), SizeGroup ); - myMaxSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); - myMaxSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - SizeGroupLayout->addWidget( myMaxSizeLabel, 1, 2 ); - SizeGroupLayout->addWidget( myMaxSizeSpinBox, 1, 3 ); - - // Magnification - QLabel* aMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), SizeGroup ); - myMagnificationSpinBox = new QtxDblSpinBox( 10, 1000, 10, SizeGroup ); - myMagnificationSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - SizeGroupLayout->addWidget( aMagnificationLabel, 2, 0 ); - SizeGroupLayout->addWidget( myMagnificationSpinBox, 2, 1 ); - - // Increment - QLabel* aIncrementLabel = new QLabel( tr( "INCREMENT" ), SizeGroup ); - myIncrementSpinBox = new QtxDblSpinBox( 0.01, 10, 0.1, SizeGroup ); - myIncrementSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + mySizeBox = new VVTK_SizeBox( aBox ); - SizeGroupLayout->addWidget( aIncrementLabel, 2, 2 ); - SizeGroupLayout->addWidget( myIncrementSpinBox, 2, 3 ); - - - // Color - myColorGroup = new QGroupBox ( tr( "COLOR_TITLE" ), aBox, "ColorGroup" ); - myColorGroup->setColumnLayout(0, Qt::Vertical ); - myColorGroup->layout()->setSpacing( 0 ); - myColorGroup->layout()->setMargin( 0 ); - - QGridLayout* ColorGroupLayout = new QGridLayout (myColorGroup->layout()); - ColorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); - ColorGroupLayout->setSpacing(6); - ColorGroupLayout->setMargin(11); - - QLabel* ColorLabel = new QLabel( tr( "COLOR" ), myColorGroup ); - myColorButton = new QPushButton( myColorGroup ); - - ColorGroupLayout->addWidget( ColorLabel, 0, 0 ); - ColorGroupLayout->addWidget( myColorButton, 0, 1 ); - - connect( myColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) ); - - connect( myGeometryButton, SIGNAL( toggled( bool ) ), myColorGroup, SLOT( setEnabled( bool ) ) ); - connect( myGeometryButton, SIGNAL( toggled( bool ) ), mySizeLabel, SLOT( setEnabled( bool ) ) ); - connect( myGeometryButton, SIGNAL( toggled( bool ) ), mySizeSpinBox, SLOT( setEnabled( bool ) ) ); - connect( myResultsButton, SIGNAL( toggled( bool ) ), myMinSizeLabel, SLOT( setEnabled( bool ) ) ); - connect( myResultsButton, SIGNAL( toggled( bool ) ), myMinSizeSpinBox, SLOT( setEnabled( bool ) ) ); - connect( myResultsButton, SIGNAL( toggled( bool ) ), myMaxSizeLabel, SLOT( setEnabled( bool ) ) ); - connect( myResultsButton, SIGNAL( toggled( bool ) ), myMaxSizeSpinBox, SLOT( setEnabled( bool ) ) ); + connect( myResultsButton, SIGNAL( clicked() ), mySizeBox, SLOT( onToggleResults() ) ); + connect( myGeometryButton, SIGNAL( clicked() ), mySizeBox, SLOT( onToggleGeometry() ) ); myScalarPane = new VisuGUI_GaussScalarBarPane(this, SetPref); myScalarPane->setMargin(5); @@ -706,59 +571,57 @@ void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::GaussPoints_i* thePrs ) myResultsButton->setChecked( isResults ); myGeometryButton->setChecked( !isResults ); - myColorGroup->setEnabled( !isResults ); - mySizeLabel->setEnabled( !isResults ); - mySizeSpinBox->setEnabled( !isResults ); - myMinSizeLabel->setEnabled( isResults ); - myMinSizeSpinBox->setEnabled( isResults ); - myMaxSizeLabel->setEnabled( isResults ); - myMaxSizeSpinBox->setEnabled( isResults ); + myPrimitiveBox->setPrimitiveType( thePrs->GetPrimitiveType() ); + myPrimitiveBox->setClampMaximum( thePrs->GetMaximumSupportedSize() ); + myPrimitiveBox->setClamp( thePrs->GetClamp() ); + myPrimitiveBox->setMainTexture( thePrs->GetMainTexture() ); + myPrimitiveBox->setAlphaTexture( thePrs->GetAlphaTexture() ); + myPrimitiveBox->setAlphaThreshold( thePrs->GetAlphaThreshold() ); + + mySizeBox->setType( isResults ? VVTK_SizeBox::Results : VVTK_SizeBox::Geometry ); + mySizeBox->setGeomSize( thePrs->GetGeomSize() ); + mySizeBox->setMinSize( thePrs->GetMinSize() ); + mySizeBox->setMaxSize( thePrs->GetMaxSize() ); + mySizeBox->setMagnification( thePrs->GetMagnification() ); + mySizeBox->setIncrement( thePrs->GetMagnificationIncrement() ); + mySizeBox->setColor( thePrs->GetColor() ); - myColorButton->setPaletteBackgroundColor( thePrs->GetColor() ); + myScalarPane->initFromPrsObject(thePrs); +} - myClampSpinBox->setMaxValue( thePrs->GetMaximumSupportedSize() ); - myClampSpinBox->setValue( thePrs->GetClamp() ); +int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::GaussPoints_i* thePrs ) +{ + thePrs->SetPrimitiveType( myPrimitiveBox->getPrimitiveType() ); - mySizeSpinBox->setValue( thePrs->GetConstSize() ); - myMinSizeSpinBox->setValue( thePrs->GetMinSize() ); - myMaxSizeSpinBox->setValue( thePrs->GetMaxSize() ); + thePrs->SetClamp( myPrimitiveBox->getClamp() ); - myMagnificationSpinBox->setValue( thePrs->GetMagnification() ); - myIncrementSpinBox->setValue( thePrs->GetMagnificationIncrement() ); + QString aMainTexture = myPrimitiveBox->getMainTexture(); + QString anAlphaTexture = myPrimitiveBox->getAlphaTexture(); - myMainTextureLineEdit->setText( thePrs->GetMainTexture().section( '/', -1 ) ); - myAlphaTextureLineEdit->setText( thePrs->GetAlphaTexture().section( '/', -1 ) ); - myAlphaThresholdSpinBox->setValue( thePrs->GetAlphaThreshold() ); + aMainTexture = aMainTexture.isNull() ? thePrs->GetMainTexture() : aMainTexture; + anAlphaTexture = anAlphaTexture.isNull() ? thePrs->GetAlphaTexture() : anAlphaTexture; + + thePrs->SetTextures( aMainTexture, anAlphaTexture ); - myScalarPane->initFromPrsObject(thePrs); -} + thePrs->SetAlphaThreshold( myPrimitiveBox->getAlphaThreshold() ); -int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::GaussPoints_i* thePrs ) -{ - thePrs->SetClamp( myClampSpinBox->value() ); bool isResults = myResultsButton->isChecked(); if( isResults ) { thePrs->SetIsColored( true ); - thePrs->SetMinSize( myMinSizeSpinBox->value() ); - thePrs->SetMaxSize( myMaxSizeSpinBox->value() ); + thePrs->SetMinSize( mySizeBox->getMinSize() ); + thePrs->SetMaxSize( mySizeBox->getMaxSize() ); } else { thePrs->SetIsColored( false ); - thePrs->SetColor( myColorButton->paletteBackgroundColor() ); - thePrs->SetConstSize( mySizeSpinBox->value() ); + thePrs->SetColor( mySizeBox->getColor() ); + thePrs->SetGeomSize( mySizeBox->getGeomSize() ); } - thePrs->SetMagnification( myMagnificationSpinBox->value() ); - thePrs->SetMagnificationIncrement( myIncrementSpinBox->value() ); - - myMainTexture = myMainTexture.isNull() ? thePrs->GetMainTexture() : myMainTexture; - myAlphaTexture = myAlphaTexture.isNull() ? thePrs->GetAlphaTexture() : myAlphaTexture; - thePrs->SetTextures( myMainTexture, myAlphaTexture ); - - thePrs->SetAlphaThreshold( myAlphaThresholdSpinBox->value() ); + thePrs->SetMagnification( mySizeBox->getMagnification() ); + thePrs->SetMagnificationIncrement( mySizeBox->getIncrement() ); return myScalarPane->storeToPrsObject(thePrs); } @@ -768,34 +631,3 @@ void VisuGUI_GaussPointsDlg::accept() //if( myScalarPane->check() ) QDialog::accept(); } - -void VisuGUI_GaussPointsDlg::onBrowseMainTexture() -{ - QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; - QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this ); - - if( aFileName.isNull() ) - return; - - myMainTexture = aFileName; - myMainTextureLineEdit->setText( aFileName.section( '/', -1 ) ); -} - -void VisuGUI_GaussPointsDlg::onBrowseAlphaTexture() -{ - QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; - QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this ); - - if( aFileName.isNull() ) - return; - - myAlphaTexture = aFileName; - myAlphaTextureLineEdit->setText( aFileName.section( '/', -1 ) ); -} - -void VisuGUI_GaussPointsDlg::onColorButtonPressed() -{ - QColor aColor = QColorDialog::getColor( myColorButton->paletteBackgroundColor(), this ); - if( aColor.isValid() ) - myColorButton->setPaletteBackgroundColor( aColor ); -} diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index 772367b2..f8514cae 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -45,6 +45,8 @@ #include class SalomeApp_Module; +class VVTK_PrimitiveBox; +class VVTK_SizeBox; class VisuGUI_TextPrefDlg; namespace VISU @@ -116,13 +118,13 @@ class VisuGUI_GaussScalarBarPane : public QVBox void onTextPref(); }; + class VisuGUI_GaussPointsDlg : public QDialog { - Q_OBJECT - + Q_OBJECT public: - VisuGUI_GaussPointsDlg (SalomeApp_Module* theModule, bool SetPref = FALSE); - ~VisuGUI_GaussPointsDlg() {}; + VisuGUI_GaussPointsDlg (SalomeApp_Module* theModule, bool SetPref = FALSE); + ~VisuGUI_GaussPointsDlg() {} void initFromPrsObject(VISU::GaussPoints_i* thePrs); int storeToPrsObject(VISU::GaussPoints_i* thePrs); @@ -130,37 +132,14 @@ public: protected slots: void accept(); - void onBrowseMainTexture(); - void onBrowseAlphaTexture(); - void onColorButtonPressed(); - private: VisuGUI_GaussScalarBarPane* myScalarPane; - QString myMainTexture; - QString myAlphaTexture; - - QtxDblSpinBox* myClampSpinBox; - - QLineEdit* myMainTextureLineEdit; - QLineEdit* myAlphaTextureLineEdit; - QtxDblSpinBox* myAlphaThresholdSpinBox; - QRadioButton* myResultsButton; QRadioButton* myGeometryButton; - QLabel* mySizeLabel; - QtxDblSpinBox* mySizeSpinBox; - QLabel* myMinSizeLabel; - QtxDblSpinBox* myMinSizeSpinBox; - QLabel* myMaxSizeLabel; - QtxDblSpinBox* myMaxSizeSpinBox; - - QtxDblSpinBox* myMagnificationSpinBox; - QtxDblSpinBox* myIncrementSpinBox; - - QGroupBox* myColorGroup; - QPushButton* myColorButton; + VVTK_PrimitiveBox* myPrimitiveBox; + VVTK_SizeBox* mySizeBox; }; #endif // VISUGUI_GAUSSPOINTSDLS_H diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index b8974989..f9b591aa 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -326,6 +326,7 @@ VisuGUI_Module createGaussPointsPreferences(); createScalarBarPreferences(); + createInsideCursorPreferences(); createOutsideCursorPreferences(); createPickingPreferences(); createSpaceMousePreferences(); @@ -440,6 +441,74 @@ VisuGUI_Module } +//--------------------------------------------------------------- +void +VisuGUI_Module +::createInsideCursorPreferences() +{ + int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) ); + + int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), insideCursorTab ); + setPreferenceProperty( primitiveGr, "columns", 1 ); + + int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr, + SalomeApp_Preferences::Selector, "VISU", "inside_point_sprite_primitive_type" ); + + QStringList values; + values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) ); + values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) ); + values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) ); + QValueList indices; + indices.append( 0 ); + indices.append( 1 ); + indices.append( 2 ); + setPreferenceProperty( primitiveTypePref, "strings", values ); + setPreferenceProperty( primitiveTypePref, "indexes", indices ); + + int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr, + SalomeApp_Preferences::IntSpin, "VISU", "inside_point_sprite_clamp" ); + setPreferenceProperty( clampPref, "min", 1 ); + setPreferenceProperty( clampPref, "max", 512 ); + + addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr, + SalomeApp_Preferences::File, "VISU", "inside_point_sprite_main_texture" ); + + addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr, + SalomeApp_Preferences::File, "VISU", "inside_point_sprite_alpha_texture" ); + + int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr, + SalomeApp_Preferences::DblSpin, "VISU", "inside_point_sprite_alpha_threshold" ); + setPreferenceProperty( alphaThresholdPref, "min", 0.0 ); + setPreferenceProperty( alphaThresholdPref, "max", 1.0 ); + setPreferenceProperty( alphaThresholdPref, "step", 0.1 ); + + int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), insideCursorTab ); + setPreferenceProperty( sizeGr, "columns", 2 ); + + int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr, + SalomeApp_Preferences::IntSpin, "VISU", "inside_point_sprite_min_size" ); + setPreferenceProperty( minSizePref, "min", 1 ); + setPreferenceProperty( minSizePref, "max", 100 ); + + int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr, + SalomeApp_Preferences::IntSpin, "VISU", "inside_point_sprite_max_size" ); + setPreferenceProperty( maxSizePref, "min", 1 ); + setPreferenceProperty( maxSizePref, "max", 100 ); + + int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr, + SalomeApp_Preferences::IntSpin, "VISU", "inside_point_sprite_magnification" ); + setPreferenceProperty( magnificationPref, "min", 10 ); + setPreferenceProperty( magnificationPref, "max", 1000 ); + + int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), sizeGr, + SalomeApp_Preferences::DblSpin, "VISU", "inside_point_sprite_increment" ); + setPreferenceProperty( incrementPref, "min", 0.01 ); + setPreferenceProperty( incrementPref, "max", 10 ); + setPreferenceProperty( incrementPref, "step", 0.1 ); + +} + + //--------------------------------------------------------------- void VisuGUI_Module @@ -450,6 +519,20 @@ VisuGUI_Module int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), outsideCursorTab ); setPreferenceProperty( primitiveGr, "columns", 1 ); + int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr, + SalomeApp_Preferences::Selector, "VISU", "outside_point_sprite_primitive_type" ); + + QStringList values; + values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) ); + values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) ); + values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) ); + QValueList indices; + indices.append( 0 ); + indices.append( 1 ); + indices.append( 2 ); + setPreferenceProperty( primitiveTypePref, "strings", values ); + setPreferenceProperty( primitiveTypePref, "indexes", indices ); + int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr, SalomeApp_Preferences::IntSpin, "VISU", "outside_point_sprite_clamp" ); setPreferenceProperty( clampPref, "min", 1 ); @@ -462,7 +545,8 @@ VisuGUI_Module SalomeApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" ); int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr, - SalomeApp_Preferences::DblSpin, "VISU", "outside_point_sprite_alpha_threshold" ); setPreferenceProperty( alphaThresholdPref, "min", 0.0 ); + SalomeApp_Preferences::DblSpin, "VISU", "outside_point_sprite_alpha_threshold" ); + setPreferenceProperty( alphaThresholdPref, "min", 0.0 ); setPreferenceProperty( alphaThresholdPref, "max", 1.0 ); setPreferenceProperty( alphaThresholdPref, "step", 0.1 ); @@ -474,6 +558,10 @@ VisuGUI_Module setPreferenceProperty( sizePref, "max", 100 ); int colorGr = addPreference( tr( "VISU_GAUSS_PREF_COLOR_GROUP_TTL" ), outsideCursorTab ); + setPreferenceProperty( colorGr, "columns", 1 ); + + addPreference( tr( "VISU_GAUSS_PREF_UNIFORM_COLOR" ), colorGr, + SalomeApp_Preferences::Bool, "VISU", "outside_point_sprite_uniform" ); addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), colorGr, SalomeApp_Preferences::Color, "VISU", "outside_point_sprite_color" ); diff --git a/src/VISUGUI/VisuGUI_Module.h b/src/VISUGUI/VisuGUI_Module.h index 33a1ec02..1081b16f 100644 --- a/src/VISUGUI/VisuGUI_Module.h +++ b/src/VISUGUI/VisuGUI_Module.h @@ -94,6 +94,10 @@ protected: void createScalarBarPreferences(); + virtual + void + createInsideCursorPreferences(); + virtual void createOutsideCursorPreferences(); diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 71750c40..951e5fcc 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -154,6 +154,9 @@ VISU::GaussPoints_i float aSpacing = aResourceMgr->doubleValue( "VISU", "scalar_bar_spacing", GetSpacing() ); SetSpacing( aSpacing ); + int aPrimitiveType = aResourceMgr->integerValue( "VISU", "point_sprite_primitive_type", GetPrimitiveType() ); + SetPrimitiveType( aPrimitiveType ); + float aClamp = aResourceMgr->doubleValue( "VISU", "point_sprite_clamp", GetClamp() ); SetClamp( aClamp ); @@ -163,8 +166,8 @@ VISU::GaussPoints_i float aMaxSize = aResourceMgr->doubleValue( "VISU", "point_sprite_max_size", GetMaxSize() ); SetMaxSize( aMaxSize ); - float aConstSize = aResourceMgr->doubleValue( "VISU", "point_sprite_size", GetConstSize() ); - SetConstSize( aConstSize ); + float aGeomSize = aResourceMgr->doubleValue( "VISU", "point_sprite_size", GetGeomSize() ); + SetGeomSize( aGeomSize ); float aMagnification = aResourceMgr->doubleValue( "VISU", "point_sprite_magnification", GetMagnification() ); SetMagnification( aMagnification ); @@ -205,10 +208,11 @@ VISU::GaussPoints_i SetBiColor(Storable::FindValue(theMap,"myIsBiColor").toInt()); SetSpacing(Storable::FindValue(theMap,"mySpacing").toDouble()); + SetPrimitiveType(Storable::FindValue(theMap,"myPrimitiveType").toInt()); SetClamp(Storable::FindValue(theMap,"myClamp").toDouble()); SetMinSize(Storable::FindValue(theMap,"myMinSize").toDouble()); SetMaxSize(Storable::FindValue(theMap,"myMaxSize").toDouble()); - SetConstSize(Storable::FindValue(theMap,"myConstSize").toDouble()); + SetGeomSize(Storable::FindValue(theMap,"myGeomSize").toDouble()); SetMagnification(Storable::FindValue(theMap,"myMagnification").toDouble()); SetMagnificationIncrement(Storable::FindValue(theMap,"myMagnificationIncrement").toDouble()); @@ -240,10 +244,11 @@ VISU::GaussPoints_i Storable::DataToStream( theStr, "myIsBiColor", GetBiColor() ); Storable::DataToStream( theStr, "mySpacing", GetSpacing() ); + Storable::DataToStream( theStr, "myPrimitiveType", GetPrimitiveType() ); Storable::DataToStream( theStr, "myClamp", GetClamp() ); Storable::DataToStream( theStr, "myMinSize", GetMinSize() ); Storable::DataToStream( theStr, "myMaxSize", GetMaxSize() ); - Storable::DataToStream( theStr, "myConstSize", GetConstSize() ); + Storable::DataToStream( theStr, "myGeomSize", GetGeomSize() ); Storable::DataToStream( theStr, "myMagnification", GetMagnification() ); Storable::DataToStream( theStr, "myMagnificationIncrement", GetMagnificationIncrement() ); @@ -329,6 +334,20 @@ VISU::GaussPoints_i return myGaussPointsPL->GetAlphaThreshold(); } +void +VISU::GaussPoints_i +::SetPrimitiveType(int thePrimitiveType) +{ + myGaussPointsPL->SetPrimitiveType( thePrimitiveType ); +} + +int +VISU::GaussPoints_i +::GetPrimitiveType() +{ + return myGaussPointsPL->GetPrimitiveType(); +} + float VISU::GaussPoints_i ::GetMaximumSupportedSize() @@ -352,14 +371,14 @@ VISU::GaussPoints_i void VISU::GaussPoints_i -::SetConstSize( float theConstSize ) +::SetGeomSize( float theGeomSize ) { - myGaussPointsPL->SetSize( theConstSize ); + myGaussPointsPL->SetSize( theGeomSize ); } float VISU::GaussPoints_i -::GetConstSize() +::GetGeomSize() { return myGaussPointsPL->GetSize(); } diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index 85d97629..52541737 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -102,6 +102,12 @@ namespace VISU float GetAlphaThreshold(); + void + SetPrimitiveType(int thePrimitiveType); + + int + GetPrimitiveType(); + float GetMaximumSupportedSize(); @@ -112,10 +118,10 @@ namespace VISU GetClamp(); void - SetConstSize(float theConstSize); + SetGeomSize(float theGeomSize); float - GetConstSize(); + GetGeomSize(); void SetMinSize(float theMinSize); diff --git a/src/VVTK/Makefile.in b/src/VVTK/Makefile.in index 1516f7dc..e11d33e8 100755 --- a/src/VVTK/Makefile.in +++ b/src/VVTK/Makefile.in @@ -19,6 +19,8 @@ EXPORT_HEADERS = \ VVTK_InteractorStyle.h \ VVTK_PickingDlg.h \ VVTK_SegmentationCursorDlg.h \ + VVTK_PrimitiveBox.h \ + VVTK_SizeBox.h \ VVTK_ViewWindow.h \ VVTK_MainWindow.h @@ -31,6 +33,8 @@ LIB_SRC = \ VVTK_InteractorStyle.cxx \ VVTK_PickingDlg.cxx \ VVTK_SegmentationCursorDlg.cxx \ + VVTK_PrimitiveBox.cxx \ + VVTK_SizeBox.cxx \ VVTK_ViewWindow.cxx \ VVTK_Renderer.cxx \ VVTK_MainWindow.cxx @@ -41,6 +45,8 @@ LIB_MOC = \ VVTK_ViewManager.h \ VVTK_PickingDlg.h \ VVTK_SegmentationCursorDlg.h \ + VVTK_PrimitiveBox.h \ + VVTK_SizeBox.h \ VVTK_MainWindow.h CPPFLAGS += \ diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx index c0b4e76a..4608ec56 100644 --- a/src/VVTK/VVTK_MainWindow.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -42,6 +42,7 @@ #include #include +#include //---------------------------------------------------------------------------- VVTK_MainWindow @@ -55,6 +56,43 @@ VVTK_MainWindow moveDockWindow(myToolBar,Qt::DockLeft); myActionsMap[NonIsometric]->removeFrom(myToolBar); + + // Recording + myRecordingToolBar = new QToolBar(this); + myRecordingToolBar->setCloseMode(QDockWindow::Undocked); + myRecordingToolBar->setLabel(tr("LBL_TOOLBAR_LABEL")); + moveDockWindow(myRecordingToolBar,Qt::DockLeft); + + myStartAction = new QtxAction(tr("MNU_VVTK_RECORDING_START"), + theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_START" ) ), + tr( "MNU_VVTK_RECORDING_START" ), 0, this); + myStartAction->setStatusTip(tr("DSC_VVTK_RECORDING_START")); + myStartAction->addTo( myRecordingToolBar ); + connect( myStartAction, SIGNAL( activated() ), this, SLOT( OnStartRecording() ) ); + + myPlayAction = new QtxAction(tr("MNU_VVTK_RECORDING_PLAY"), + theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_PLAY" ) ), + tr( "MNU_VVTK_RECORDING_PLAY" ), 0, this); + myPlayAction->setStatusTip(tr("DSC_VVTK_RECORDING_PLAY")); + myPlayAction->setEnabled( false ); + myPlayAction->addTo( myRecordingToolBar ); + connect( myPlayAction, SIGNAL( activated() ), this, SLOT( OnPlayRecording() ) ); + + myPauseAction = new QtxAction(tr("MNU_VVTK_RECORDING_PAUSE"), + theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_PAUSE" ) ), + tr( "MNU_VVTK_RECORDING_PAUSE" ), 0, this); + myPauseAction->setStatusTip(tr("DSC_VVTK_RECORDING_PAUSE")); + myPauseAction->setEnabled( false ); + myPauseAction->addTo( myRecordingToolBar ); + connect( myPauseAction, SIGNAL( activated() ), this, SLOT( OnPauseRecording() ) ); + + myStopAction = new QtxAction(tr("MNU_VVTK_RECORDING_STOP"), + theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_RECORDING_STOP" ) ), + tr( "MNU_VVTK_RECORDING_STOP" ), 0, this); + myStopAction->setStatusTip(tr("DSC_VVTK_RECORDING_STOP")); + myStopAction->setEnabled( false ); + myStopAction->addTo( myRecordingToolBar ); + connect( myStopAction, SIGNAL( activated() ), this, SLOT( OnStopRecording() ) ); } void @@ -89,6 +127,54 @@ VVTK_MainWindow SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection); } +//---------------------------------------------------------------------------- +void +VVTK_MainWindow +::OnStartRecording() +{ + QString aFileName = QFileDialog::getOpenFileName( "/data/ouv/SALOME", "*.avi", this ); + if( aFileName.isNull() ) + return; + + myStartAction->setEnabled( false ); + myPlayAction->setEnabled( false ); + myPauseAction->setEnabled( true ); + myStopAction->setEnabled( true ); +} + +//---------------------------------------------------------------------------- +void +VVTK_MainWindow +::OnPlayRecording() +{ + myStartAction->setEnabled( false ); + myPlayAction->setEnabled( false ); + myPauseAction->setEnabled( true ); + myStopAction->setEnabled( true ); +} + +//---------------------------------------------------------------------------- +void +VVTK_MainWindow +::OnPauseRecording() +{ + myStartAction->setEnabled( false ); + myPlayAction->setEnabled( true ); + myPauseAction->setEnabled( false ); + myStopAction->setEnabled( true ); +} + +//---------------------------------------------------------------------------- +void +VVTK_MainWindow +::OnStopRecording() +{ + myStartAction->setEnabled( true ); + myPlayAction->setEnabled( false ); + myPauseAction->setEnabled( false ); + myStopAction->setEnabled( false ); +} + //---------------------------------------------------------------------------- int convertAction( const int accelAction ); @@ -156,21 +242,36 @@ VVTK_MainWindow1 myPickingDlg->SetAction( anAction ); myInteractorStyle->SetPickingSettings(myPickingDlg->GetPickingSettings()); + // Plane/Sphere Segmentation aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_PLANE_SEGMENTATION_SWITCH")); - anAction = new QtxAction(tr("MNU_VVTK_PLANE_SEGMENTATION_SWITCH"), - aPixmap, - tr( "MNU_VVTK_PLANE_SEGMENTATION_SWITCH" ), - 0, - this, - "VVTK/SVTK PlaneSegmentationSwitch", - true); - anAction->setToggleAction(true); - anAction->setStatusTip(tr("DSC_VVTK_PLANE_SEGMENTATION_SWITCH")); - connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnPlaneSegmentationSwitch(bool))); - anAction->addTo( myPtsToolBar ); + myPlaneSegmentationAction = new QtxAction(tr("MNU_VVTK_PLANE_SEGMENTATION_SWITCH"), + aPixmap, + tr( "MNU_VVTK_PLANE_SEGMENTATION_SWITCH" ), + 0, + this, + "VVTK/SVTK PlaneSegmentationSwitch", + true); + myPlaneSegmentationAction->setToggleAction(true); + myPlaneSegmentationAction->setStatusTip(tr("DSC_VVTK_PLANE_SEGMENTATION_SWITCH")); + myPlaneSegmentationAction->addTo( myPtsToolBar ); + connect( myPlaneSegmentationAction, SIGNAL( toggled( bool ) ), this, SLOT( OnSegmentationSwitch( bool ) ) ); + + aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SPHERE_SEGMENTATION_SWITCH")); + mySphereSegmentationAction = new QtxAction(tr("MNU_VVTK_SPHERE_SEGMENTATION_SWITCH"), + aPixmap, + tr( "MNU_VVTK_SPHERE_SEGMENTATION_SWITCH" ), + 0, + this, + "VVTK/SVTK SphereSegmentationSwitch", + true); + mySphereSegmentationAction->setToggleAction(true); + mySphereSegmentationAction->setStatusTip(tr("DSC_VVTK_SPHERE_SEGMENTATION_SWITCH")); + mySphereSegmentationAction->addTo( myPtsToolBar ); + connect( mySphereSegmentationAction, SIGNAL( toggled( bool ) ), this, SLOT( OnSegmentationSwitch( bool ) ) ); mySegmentationCursorDlg = new VVTK_SegmentationCursorDlg( this, "SegmentationCursorDlg" ); - mySegmentationCursorDlg->SetAction( anAction ); + mySegmentationCursorDlg->SetPlaneAction( myPlaneSegmentationAction ); + mySegmentationCursorDlg->SetSphereAction( mySphereSegmentationAction ); } void @@ -233,6 +334,13 @@ VVTK_MainWindow1 return myRenderer->GetImplicitFunctionWidget(); } +VISU_InsideCursorSettings* +VVTK_MainWindow1 +::GetInsideCursorSettings() +{ + return mySegmentationCursorDlg->GetInsideCursorSettings(); +} + VISU_OutsideCursorSettings* VVTK_MainWindow1 ::GetOutsideCursorSettings() @@ -250,16 +358,26 @@ VVTK_MainWindow1 //---------------------------------------------------------------------------- void VVTK_MainWindow1 -::OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn) +::OnSegmentationSwitch(bool theIsSegmentationOn) { - myRenderer->GetImplicitFunctionWidget()->SetEnabled(theIsPlaneSegmentationOn); - //mySplitter->setCollapsible(this,!theIsPlaneSegmentationOn); + QtxAction* anAction = ( QtxAction* )sender(); + if( !anAction ) + return; + + myRenderer->GetImplicitFunctionWidget()->SetEnabled(theIsSegmentationOn); + + if( anAction == myPlaneSegmentationAction && theIsSegmentationOn ) + mySphereSegmentationAction->setOn( false ); + else if( anAction == mySphereSegmentationAction && theIsSegmentationOn ) + myPlaneSegmentationAction->setOn( false ); - if( theIsPlaneSegmentationOn ) + if( theIsSegmentationOn ) { myMainWindow2->show(); + mySegmentationCursorDlg->SetIsPlaneSegmentation( anAction == myPlaneSegmentationAction ); mySegmentationCursorDlg->UpdateSegmentation(); - mySegmentationCursorDlg->UpdateOutsideCursor(); + mySegmentationCursorDlg->UpdateInsideGaussPoints(); + mySegmentationCursorDlg->UpdateOutsideGaussPoints(); mySegmentationCursorDlg->show(); } else diff --git a/src/VVTK/VVTK_MainWindow.h b/src/VVTK/VVTK_MainWindow.h index 4220d5ce..27b28c29 100644 --- a/src/VVTK/VVTK_MainWindow.h +++ b/src/VVTK/VVTK_MainWindow.h @@ -12,6 +12,7 @@ class QSplitter; class VISU_ImplicitFunctionWidget; class VVTK_SegmentationCursorDlg; +class VISU_InsideCursorSettings; class VISU_OutsideCursorSettings; class VISU_PickingSettings; class VVTK_InteractorStyle; @@ -49,8 +50,30 @@ public: void action( const int ); + virtual + void + OnStartRecording(); + + virtual + void + OnPlayRecording(); + + virtual + void + OnPauseRecording(); + + virtual + void + OnStopRecording(); + protected: vtkSmartPointer myInteractorStyle; + + QToolBar* myRecordingToolBar; + QtxAction* myStartAction; + QtxAction* myPlayAction; + QtxAction* myPauseAction; + QtxAction* myStopAction; }; @@ -81,6 +104,9 @@ public: VISU_ImplicitFunctionWidget* GetImplicitFunctionWidget(); + VISU_InsideCursorSettings* + GetInsideCursorSettings(); + VISU_OutsideCursorSettings* GetOutsideCursorSettings(); @@ -89,7 +115,7 @@ public: public slots: void - OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn); + OnSegmentationSwitch(bool theIsSegmentationOn); virtual void @@ -104,6 +130,9 @@ public: QToolBar* myPtsToolBar; QSplitter* mySplitter; + QtxAction* myPlaneSegmentationAction; + QtxAction* mySphereSegmentationAction; + VVTK_SegmentationCursorDlg* mySegmentationCursorDlg; VVTK_PickingDlg* myPickingDlg; }; diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx index ca0d7f09..4bdf4a44 100644 --- a/src/VVTK/VVTK_PickingDlg.cxx +++ b/src/VVTK/VVTK_PickingDlg.cxx @@ -203,7 +203,7 @@ void VVTK_PickingDlg::Update() if( !myPickingSettings->GetInitial() ) { myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() ); - myTransparencySpinBox->setValue( myPickingSettings->GetInfoWindowTransparency() * 100.0 ); + myTransparencySpinBox->setValue( ( int )myPickingSettings->GetInfoWindowTransparency() * 100 ); myPositionComboBox->setCurrentItem( myPickingSettings->GetInfoWindowPosition() ); myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() ); myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() ); diff --git a/src/VVTK/VVTK_PrimitiveBox.cxx b/src/VVTK/VVTK_PrimitiveBox.cxx new file mode 100644 index 00000000..8bb0b8ea --- /dev/null +++ b/src/VVTK/VVTK_PrimitiveBox.cxx @@ -0,0 +1,264 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VVTK_PrimitiveBox.cxx +// Author : Oleg UVAROV +// Module : VISU + +#include "VVTK_PrimitiveBox.h" + +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" + +#include "QtxDblSpinBox.h" + +#include +#include +#include +#include +#include +#include +#include + +#include + +using namespace std; + +VVTK_PrimitiveBox::VVTK_PrimitiveBox( QWidget* parent ) : + QGroupBox( parent ) +{ + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + + setTitle( tr( "PRIMITIVE_TITLE" ) ); + setColumnLayout(0, Qt::Vertical ); + layout()->setSpacing( 0 ); + layout()->setMargin( 0 ); + + QGridLayout* aLayout = new QGridLayout( layout() ); + aLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + aLayout->setSpacing(6); + aLayout->setMargin(11); + + myPrimitiveType = VVTK_PrimitiveBox::PointSprite; + + QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; + myMainTexture = aRootDir + "sprite_texture.bmp"; + myAlphaTexture = aRootDir + "sprite_alpha.bmp"; + + // Primitive Type + QButtonGroup* aPrimitiveTypeGroup = new QButtonGroup( 3, Qt::Horizontal, this, "PrimitiveTypeGroup" ); + aPrimitiveTypeGroup->setMinimumWidth( 450 ); + aPrimitiveTypeGroup->setRadioButtonExclusive( true ); + aPrimitiveTypeGroup->setFrameStyle( QFrame::NoFrame ); + aPrimitiveTypeGroup->layout()->setMargin( 0 ); + + myPointSpriteButton = new QRadioButton( tr( "POINT_SPRITE" ), aPrimitiveTypeGroup ); + myOpenGLPointButton = new QRadioButton( tr( "OPENGL_POINT" ), aPrimitiveTypeGroup ); + myGeomSphereButton = new QRadioButton( tr( "GEOMETRICAL_SPHERE" ), aPrimitiveTypeGroup ); + + aLayout->addMultiCellWidget( aPrimitiveTypeGroup, 0, 0, 0, 2 ); + + // Clamp + myClampLabel = new QLabel( tr( "CLAMP" ), this ); + myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, this ); + myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + aLayout->addWidget( myClampLabel, 1, 0 ); + aLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 ); + + // Main Texture + myMainTextureLabel = new QLabel( tr( "MAIN_TEXTURE" ), this ); + myMainTextureLineEdit = new QLineEdit( this ); + myMainTextureButton = new QPushButton( this ); + myMainTextureButton->setAutoDefault( false ); + myMainTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) ); + connect( myMainTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseMainTexture() ) ); + + aLayout->addWidget( myMainTextureLabel, 2, 0 ); + aLayout->addWidget( myMainTextureLineEdit, 2, 1 ); + aLayout->addWidget( myMainTextureButton, 2, 2 ); + + // Alpha Texture + myAlphaTextureLabel = new QLabel( tr( "ALPHA_TEXTURE" ), this ); + myAlphaTextureLineEdit = new QLineEdit( this ); + myAlphaTextureButton = new QPushButton( this ); + myAlphaTextureButton->setAutoDefault( false ); + myAlphaTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) ); + connect( myAlphaTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseAlphaTexture() ) ); + + aLayout->addWidget( myAlphaTextureLabel, 3, 0 ); + aLayout->addWidget( myAlphaTextureLineEdit, 3, 1 ); + aLayout->addWidget( myAlphaTextureButton, 3, 2 ); + + // Alpha Threshold + myAlphaThresholdLabel = new QLabel( tr( "ALPHA_THRESHOLD" ), this ); + myAlphaThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, this ); + myAlphaThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + aLayout->addWidget( myAlphaThresholdLabel, 4, 0 ); + aLayout->addMultiCellWidget( myAlphaThresholdSpinBox, 4, 4, 1, 2 ); + + connect( myPointSpriteButton, SIGNAL( clicked() ), this, SLOT( onTogglePointSprite() ) ); + connect( myOpenGLPointButton, SIGNAL( clicked() ), this, SLOT( onToggleOpenGLPoint() ) ); + connect( myGeomSphereButton, SIGNAL( clicked() ), this, SLOT( onToggleGeomSphere() ) ); +} + +void VVTK_PrimitiveBox::onTogglePointSprite() +{ + myPrimitiveType = VVTK_PrimitiveBox::PointSprite; + + myClampLabel->show(); + myClampSpinBox->show(); + + myMainTextureLabel->show(); + myMainTextureLineEdit->show(); + myMainTextureButton->show(); + + myAlphaTextureLabel->show(); + myAlphaTextureLineEdit->show(); + myAlphaTextureButton->show(); + + myAlphaThresholdLabel->show(); + myAlphaThresholdSpinBox->show(); +} + +void VVTK_PrimitiveBox::onToggleOpenGLPoint() +{ + myPrimitiveType = VVTK_PrimitiveBox::OpenGLPoint; + + myClampLabel->show(); + myClampSpinBox->show(); + + myMainTextureLabel->hide(); + myMainTextureLineEdit->hide(); + myMainTextureButton->hide(); + + myAlphaTextureLabel->hide(); + myAlphaTextureLineEdit->hide(); + myAlphaTextureButton->hide(); + + myAlphaThresholdLabel->hide(); + myAlphaThresholdSpinBox->hide(); +} + +void VVTK_PrimitiveBox::onToggleGeomSphere() +{ + myPrimitiveType = VVTK_PrimitiveBox::GeomSphere; + + myClampLabel->hide(); + myClampSpinBox->hide(); + + myMainTextureLabel->hide(); + myMainTextureLineEdit->hide(); + myMainTextureButton->hide(); + + myAlphaTextureLabel->hide(); + myAlphaTextureLineEdit->hide(); + myAlphaTextureButton->hide(); + + myAlphaThresholdLabel->hide(); + myAlphaThresholdSpinBox->hide(); +} + +void VVTK_PrimitiveBox::setPrimitiveType( int theType ) +{ + myPrimitiveType = theType; + + switch( myPrimitiveType ) + { + case VVTK_PrimitiveBox::PointSprite : + myPointSpriteButton->setChecked( true ); + onTogglePointSprite(); + break; + case VVTK_PrimitiveBox::OpenGLPoint : + myOpenGLPointButton->setChecked( true ); + onToggleOpenGLPoint(); + break; + case VVTK_PrimitiveBox::GeomSphere : + myGeomSphereButton->setChecked( true ); + onToggleGeomSphere(); + break; + default : break; + } +} + +float VVTK_PrimitiveBox::getClamp() const +{ + return myClampSpinBox->value(); +} + +void VVTK_PrimitiveBox::setClamp( float theClamp ) +{ + myClampSpinBox->setValue( theClamp ); +} + +void VVTK_PrimitiveBox::setClampMaximum( float theClampMaximum ) +{ + myClampSpinBox->setMaxValue( theClampMaximum ); +} + +void VVTK_PrimitiveBox::setMainTexture( const QString& theMainTexture ) +{ + myMainTexture = theMainTexture; + myMainTextureLineEdit->setText( theMainTexture.section( '/', -1 ) ); +} + +void VVTK_PrimitiveBox::setAlphaTexture( const QString& theAlphaTexture ) +{ + myAlphaTexture = theAlphaTexture; + myAlphaTextureLineEdit->setText( theAlphaTexture.section( '/', -1 ) ); +} + +float VVTK_PrimitiveBox::getAlphaThreshold() const +{ + return myAlphaThresholdSpinBox->value(); +} + +void VVTK_PrimitiveBox::setAlphaThreshold( float theAlphaThreshold ) +{ + myAlphaThresholdSpinBox->setValue( theAlphaThreshold ); +} + +void VVTK_PrimitiveBox::onBrowseMainTexture() +{ + QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; + QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this ); + + if( aFileName.isNull() ) + return; + + myMainTexture = aFileName; + myMainTextureLineEdit->setText( aFileName.section( '/', -1 ) ); +} + +void VVTK_PrimitiveBox::onBrowseAlphaTexture() +{ + QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; + QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this ); + + if( aFileName.isNull() ) + return; + + myAlphaTexture = aFileName; + myAlphaTextureLineEdit->setText( aFileName.section( '/', -1 ) ); +} diff --git a/src/VVTK/VVTK_PrimitiveBox.h b/src/VVTK/VVTK_PrimitiveBox.h new file mode 100644 index 00000000..1c60329a --- /dev/null +++ b/src/VVTK/VVTK_PrimitiveBox.h @@ -0,0 +1,103 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VVTK_PrimitiveBox.h +// Author : Oleg UVAROV +// Module : VISU + +#ifndef VVTK_PRIMITIVEBOX_H +#define VVTK_PRIMITIVEBOX_H + +#include + +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; + +class QtxDblSpinBox; + +class VVTK_PrimitiveBox : public QGroupBox +{ + Q_OBJECT + +public: + enum { PointSprite = 0, OpenGLPoint, GeomSphere }; + +public: + VVTK_PrimitiveBox( QWidget* ); + ~VVTK_PrimitiveBox() {} + +public: + int getPrimitiveType() const { return myPrimitiveType; } + void setPrimitiveType( int ); + + float getClamp() const; + void setClamp( float ); + void setClampMaximum( float ); + + QString getMainTexture() const { return myMainTexture; } + void setMainTexture( const QString& ); + + QString getAlphaTexture() const { return myAlphaTexture; } + void setAlphaTexture( const QString& ); + + float getAlphaThreshold() const; + void setAlphaThreshold( float ); + +protected slots: + void onTogglePointSprite(); + void onToggleOpenGLPoint(); + void onToggleGeomSphere(); + + void onBrowseMainTexture(); + void onBrowseAlphaTexture(); + +private: + int myPrimitiveType; + + QRadioButton* myPointSpriteButton; + QRadioButton* myOpenGLPointButton; + QRadioButton* myGeomSphereButton; + + QString myMainTexture; + QString myAlphaTexture; + + QLabel* myClampLabel; + QtxDblSpinBox* myClampSpinBox; + + QLabel* myMainTextureLabel; + QLineEdit* myMainTextureLineEdit; + QPushButton* myMainTextureButton; + + QLabel* myAlphaTextureLabel; + QLineEdit* myAlphaTextureLineEdit; + QPushButton* myAlphaTextureButton; + + QLabel* myAlphaThresholdLabel; + QtxDblSpinBox* myAlphaThresholdSpinBox; +}; + + + +#endif diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 142008d1..8ae7add6 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -138,6 +138,7 @@ vtkStandardNewMacro(VVTK_Renderer); VVTK_Renderer ::VVTK_Renderer(): myFPSActor(VISU_FPSActor::New()), + myInsideCursorSettings(NULL), myPickingSettings(NULL) { if(MYDEBUG) INFOS("VVTK_Renderer() - "<(theActor)){ + anActor->SetInsideCursorSettings(myInsideCursorSettings); anActor->SetPickingSettings(myPickingSettings); Superclass::AddActor(anActor); } @@ -183,12 +185,21 @@ VVTK_Renderer ::RemoveActor(VTKViewer_Actor* theActor) { using namespace VISU; - if(VISU_GaussPtsAct1* anActor = dynamic_cast(theActor)){ + if(VISU_GaussPtsAct* anActor = dynamic_cast(theActor)){ + anActor->SetInsideCursorSettings(NULL); anActor->SetPickingSettings(NULL); Superclass::RemoveActor(theActor); } } +//---------------------------------------------------------------------------- +void +VVTK_Renderer +::SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings) +{ + myInsideCursorSettings = theInsideCursorSettings; +} + //---------------------------------------------------------------------------- void VVTK_Renderer diff --git a/src/VVTK/VVTK_Renderer.h b/src/VVTK/VVTK_Renderer.h index 0c50b277..c0130a24 100644 --- a/src/VVTK/VVTK_Renderer.h +++ b/src/VVTK/VVTK_Renderer.h @@ -34,6 +34,7 @@ #include "SVTK_Renderer.h" class VISU_ImplicitFunctionWidget; +class VISU_InsideCursorSettings; class VISU_OutsideCursorSettings; class VISU_PickingSettings; class VISU_FPSActor; @@ -55,6 +56,9 @@ class VVTK_EXPORT VVTK_Renderer : public SVTK_Renderer void RemoveActor(VTKViewer_Actor* theActor); + void + SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings); + void SetPickingSettings(VISU_PickingSettings* thePickingSettings); @@ -62,6 +66,7 @@ class VVTK_EXPORT VVTK_Renderer : public SVTK_Renderer VVTK_Renderer(); ~VVTK_Renderer(); + VISU_InsideCursorSettings* myInsideCursorSettings; VISU_PickingSettings* myPickingSettings; vtkSmartPointer myFPSActor; }; diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx index 4e20b11b..4be07d71 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ b/src/VVTK/VVTK_SegmentationCursorDlg.cxx @@ -9,6 +9,8 @@ // Module : VISU #include "VVTK_SegmentationCursorDlg.h" +#include "VVTK_PrimitiveBox.h" +#include "VVTK_SizeBox.h" #include "VISU_GaussPtsAct.h" #include "VISU_GaussPtsSettings.h" @@ -48,7 +50,9 @@ using namespace std; VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const char* name ) :QDialog( parent, name, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), myEventCallbackCommand( vtkCallbackCommand::New() ), - myOutsideCursorSettings( VISU_OutsideCursorSettings::New() ) + myInsideCursorSettings( VISU_InsideCursorSettings::New() ), + myOutsideCursorSettings( VISU_OutsideCursorSettings::New() ), + myIsPlaneSegmentation( true ) { myPriority = 0.0; myEventCallbackCommand->Delete(); @@ -70,32 +74,33 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c mySegmentationCursorBox = new QVBox( this ); mySegmentationCursorBox->setMargin(11); mySegmentationCursorBox->setSpacing(6); + mySegmentationCursorBox->layout()->setAlignment(Qt::AlignTop); // Origin - QGroupBox* OriginGroup = new QGroupBox( tr( "ORIGIN_TITLE" ), mySegmentationCursorBox, "OriginGroup" ); - OriginGroup->setColumnLayout( 0, Qt::Vertical ); - OriginGroup->layout()->setSpacing( 0 ); - OriginGroup->layout()->setMargin( 0 ); + myOriginGroup = new QGroupBox( tr( "ORIGIN_TITLE" ), mySegmentationCursorBox, "OriginGroup" ); + myOriginGroup->setColumnLayout( 0, Qt::Vertical ); + myOriginGroup->layout()->setSpacing( 0 ); + myOriginGroup->layout()->setMargin( 0 ); - QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup->layout() ); + QGridLayout* OriginGroupLayout = new QGridLayout( myOriginGroup->layout() ); OriginGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); OriginGroupLayout->setSpacing(6); OriginGroupLayout->setMargin(11); - QLabel* XOriginLabel = new QLabel( tr( "ORIGIN_X" ), OriginGroup ); - myXOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, OriginGroup ); + QLabel* XOriginLabel = new QLabel( tr( "ORIGIN_X" ), myOriginGroup ); + myXOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, myOriginGroup ); myXOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myXOriginSpinBox->setMinimumWidth( 100 ); myXOriginSpinBox->setValue( 0.0 ); - QLabel* YOriginLabel = new QLabel( tr( "ORIGIN_Y" ), OriginGroup ); - myYOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, OriginGroup ); + QLabel* YOriginLabel = new QLabel( tr( "ORIGIN_Y" ), myOriginGroup ); + myYOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, myOriginGroup ); myYOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myYOriginSpinBox->setMinimumWidth( 100 ); myYOriginSpinBox->setValue( 0.0 ); - QLabel* ZOriginLabel = new QLabel( tr( "ORIGIN_Z" ), OriginGroup ); - myZOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, OriginGroup ); + QLabel* ZOriginLabel = new QLabel( tr( "ORIGIN_Z" ), myOriginGroup ); + myZOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, myOriginGroup ); myZOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myZOriginSpinBox->setMinimumWidth( 100 ); myZOriginSpinBox->setValue( 0.0 ); @@ -107,31 +112,31 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c OriginGroupLayout->addWidget( ZOriginLabel, 0, 4 ); OriginGroupLayout->addWidget( myZOriginSpinBox, 0, 5 ); - // Direction - QGroupBox* DirectionGroup = new QGroupBox( tr( "DIRECTION_TITLE" ), mySegmentationCursorBox, "DirectionGroup" ); - DirectionGroup->setColumnLayout( 0, Qt::Vertical ); - DirectionGroup->layout()->setSpacing( 0 ); - DirectionGroup->layout()->setMargin( 0 ); + // Direction ( Plane Segmentation ) + myDirectionGroup = new QGroupBox( tr( "DIRECTION_TITLE" ), mySegmentationCursorBox, "DirectionGroup" ); + myDirectionGroup->setColumnLayout( 0, Qt::Vertical ); + myDirectionGroup->layout()->setSpacing( 0 ); + myDirectionGroup->layout()->setMargin( 0 ); - QGridLayout* DirectionGroupLayout = new QGridLayout( DirectionGroup->layout() ); + QGridLayout* DirectionGroupLayout = new QGridLayout( myDirectionGroup->layout() ); DirectionGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); DirectionGroupLayout->setSpacing(6); DirectionGroupLayout->setMargin(11); - QLabel* DXDirectionLabel = new QLabel( tr( "DIRECTION_DX" ), DirectionGroup ); - myDXDirectionSpinBox = new QtxDblSpinBox( -1.0, 1.0, 0.1, DirectionGroup ); + QLabel* DXDirectionLabel = new QLabel( tr( "DIRECTION_DX" ), myDirectionGroup ); + myDXDirectionSpinBox = new QtxDblSpinBox( -1.0, 1.0, 0.1, myDirectionGroup ); myDXDirectionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myDXDirectionSpinBox->setMinimumWidth( 100 ); myDXDirectionSpinBox->setValue( 0.0 ); - QLabel* DYDirectionLabel = new QLabel( tr( "DIRECTION_DY" ), DirectionGroup ); - myDYDirectionSpinBox = new QtxDblSpinBox( -1.0, 1.0, 0.1, DirectionGroup ); + QLabel* DYDirectionLabel = new QLabel( tr( "DIRECTION_DY" ), myDirectionGroup ); + myDYDirectionSpinBox = new QtxDblSpinBox( -1.0, 1.0, 0.1, myDirectionGroup ); myDYDirectionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myDYDirectionSpinBox->setMinimumWidth( 100 ); myDYDirectionSpinBox->setValue( 0.0 ); - QLabel* DZDirectionLabel = new QLabel( tr( "DIRECTION_DZ" ), DirectionGroup ); - myDZDirectionSpinBox = new QtxDblSpinBox( -1.0, 1.0, 0.1, DirectionGroup ); + QLabel* DZDirectionLabel = new QLabel( tr( "DIRECTION_DZ" ), myDirectionGroup ); + myDZDirectionSpinBox = new QtxDblSpinBox( -1.0, 1.0, 0.1, myDirectionGroup ); myDZDirectionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myDZDirectionSpinBox->setMinimumWidth( 100 ); myDZDirectionSpinBox->setValue( 1.0 ); @@ -143,147 +148,107 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c DirectionGroupLayout->addWidget( DZDirectionLabel, 0, 4 ); DirectionGroupLayout->addWidget( myDZDirectionSpinBox, 0, 5 ); - // Depth - QGroupBox* DepthGroup = new QGroupBox( tr( "DEPTH_TITLE" ), mySegmentationCursorBox, "DepthGroup" ); - DepthGroup->setColumnLayout( 0, Qt::Vertical ); - DepthGroup->layout()->setSpacing( 0 ); - DepthGroup->layout()->setMargin( 0 ); + // Depth ( Plane Segmentation ) + myDepthGroup = new QGroupBox( tr( "DEPTH_TITLE" ), mySegmentationCursorBox, "DepthGroup" ); + myDepthGroup->setColumnLayout( 0, Qt::Vertical ); + myDepthGroup->layout()->setSpacing( 0 ); + myDepthGroup->layout()->setMargin( 0 ); - QGridLayout* DepthGroupLayout = new QGridLayout( DepthGroup->layout() ); + QGridLayout* DepthGroupLayout = new QGridLayout( myDepthGroup->layout() ); DepthGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); DepthGroupLayout->setSpacing(6); DepthGroupLayout->setMargin(11); - QLabel* DepthLabel = new QLabel( tr( "DEPTH" ), DepthGroup ); - myDepthSpinBox = new QtxDblSpinBox( 0.0, VTK_LARGE_FLOAT, 0.1, DepthGroup ); + QLabel* DepthLabel = new QLabel( tr( "DEPTH" ), myDepthGroup ); + myDepthSpinBox = new QtxDblSpinBox( 0.0, VTK_LARGE_FLOAT, 0.1, myDepthGroup ); myDepthSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myDepthSpinBox->setMinimumWidth( 100 ); - myDepthSpinBox->setValue( 10.0 ); + myDepthSpinBox->setValue( 1.0 ); DepthGroupLayout->addWidget( DepthLabel, 0, 0 ); DepthGroupLayout->addWidget( myDepthSpinBox, 0, 1 ); + // Radius ( Sphere Segmentation ) + myRadiusGroup = new QGroupBox( tr( "RADIUS_TITLE" ), mySegmentationCursorBox, "RadiusGroup" ); + myRadiusGroup->setColumnLayout( 0, Qt::Vertical ); + myRadiusGroup->layout()->setSpacing( 0 ); + myRadiusGroup->layout()->setMargin( 0 ); - myTabBox->addTab( mySegmentationCursorBox, tr("SEGMENTATION_CURSOR_TAB") ); + QGridLayout* RadiusGroupLayout = new QGridLayout( myRadiusGroup->layout() ); + RadiusGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + RadiusGroupLayout->setSpacing(6); + RadiusGroupLayout->setMargin(11); + QLabel* RadiusLabel = new QLabel( tr( "RADIUS" ),myRadiusGroup ); + myRadiusSpinBox = new QtxDblSpinBox( 0.0, 1000.0, 1.0,myRadiusGroup ); + myRadiusSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myRadiusSpinBox->setMinimumWidth( 100 ); + myRadiusSpinBox->setValue( 100.0 ); - // Outside cursor pane - myOutsideCursorBox = new QVBox( this ); - myOutsideCursorBox->setMargin(11); - myOutsideCursorBox->setSpacing(6); + QLabel* RatioLabel = new QLabel( tr( "RATIO" ), myRadiusGroup ); + myRatioSpinBox = new QtxDblSpinBox( 0.1, 10.0, 0.1,myRadiusGroup ); + myRatioSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myRatioSpinBox->setMinimumWidth( 100 ); + myRatioSpinBox->setValue( 2.0 ); - // Primitive - QGroupBox* PrimitiveGroup = new QGroupBox( tr( "PRIMITIVE_TITLE" ), myOutsideCursorBox, "PrimitiveGroup" ); - PrimitiveGroup->setColumnLayout(0, Qt::Vertical ); - PrimitiveGroup->layout()->setSpacing( 0 ); - PrimitiveGroup->layout()->setMargin( 0 ); - - QGridLayout* PrimitiveGroupLayout = new QGridLayout (PrimitiveGroup->layout()); - PrimitiveGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - PrimitiveGroupLayout->setSpacing(6); - PrimitiveGroupLayout->setMargin(11); - - // Primitive Type - QButtonGroup* PrimitiveTypeGroup = new QButtonGroup( 3, Qt::Horizontal, PrimitiveGroup, "PrimitiveTypeGroup" ); - PrimitiveTypeGroup->setRadioButtonExclusive( true ); - PrimitiveTypeGroup->setFrameStyle( QFrame::NoFrame ); - PrimitiveTypeGroup->layout()->setMargin( 0 ); - - QRadioButton* PointSpriteButton = new QRadioButton( tr( "POINT_SPRITE" ), PrimitiveTypeGroup ); - PointSpriteButton->setChecked( true ); - - QRadioButton* OpenGLPointButton = new QRadioButton( tr( "OPENGL_POINT" ), PrimitiveTypeGroup ); - OpenGLPointButton->setEnabled( false ); - - QRadioButton* GeometricalSphereButton = new QRadioButton( tr( "GEOMETRICAL_SPHERE" ), PrimitiveTypeGroup ); - GeometricalSphereButton->setEnabled( false ); - - PrimitiveGroupLayout->addMultiCellWidget( PrimitiveTypeGroup, 0, 0, 0, 2 ); - - // Clamp - QLabel* ClampLabel = new QLabel( tr( "MAXIMUM_SIZE" ), PrimitiveGroup ); - myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, PrimitiveGroup ); - myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - PrimitiveGroupLayout->addWidget( ClampLabel, 1, 0 ); - PrimitiveGroupLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 ); - - // Main Texture - QLabel* MainTextureLabel = new QLabel( tr( "MAIN_TEXTURE" ), PrimitiveGroup ); - myMainTextureLineEdit = new QLineEdit( PrimitiveGroup ); - QPushButton* MainTextureButton = new QPushButton( PrimitiveGroup ); - MainTextureButton->setAutoDefault( false ); - MainTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) ); - connect( MainTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseMainTexture() ) ); - - PrimitiveGroupLayout->addWidget( MainTextureLabel, 2, 0 ); - PrimitiveGroupLayout->addWidget( myMainTextureLineEdit, 2, 1 ); - PrimitiveGroupLayout->addWidget( MainTextureButton, 2, 2 ); - - // Alpha Texture - QLabel* AlphaTextureLabel = new QLabel( tr( "ALPHA_TEXTURE" ), PrimitiveGroup ); - myAlphaTextureLineEdit = new QLineEdit( PrimitiveGroup ); - QPushButton* AlphaTextureButton = new QPushButton( PrimitiveGroup ); - AlphaTextureButton->setAutoDefault( false ); - AlphaTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) ); - connect( AlphaTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseAlphaTexture() ) ); - - PrimitiveGroupLayout->addWidget( AlphaTextureLabel, 3, 0 ); - PrimitiveGroupLayout->addWidget( myAlphaTextureLineEdit, 3, 1 ); - PrimitiveGroupLayout->addWidget( AlphaTextureButton, 3, 2 ); - - // Alpha Threshold - QLabel* AlphaThresholdLabel = new QLabel( tr( "ALPHA_THRESHOLD" ), PrimitiveGroup ); - myAlphaThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, PrimitiveGroup ); - myAlphaThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - - PrimitiveGroupLayout->addWidget( AlphaThresholdLabel, 4, 0 ); - PrimitiveGroupLayout->addMultiCellWidget( myAlphaThresholdSpinBox, 4, 4, 1, 2 ); + RadiusGroupLayout->addWidget( RadiusLabel, 0, 0 ); + RadiusGroupLayout->addWidget( myRadiusSpinBox, 0, 1 ); + RadiusGroupLayout->addWidget( RatioLabel, 0, 2 ); + RadiusGroupLayout->addWidget( myRatioSpinBox, 0, 3 ); - // Size - QGroupBox* SizeGroup = new QGroupBox ( tr( "SIZE_TITLE" ), myOutsideCursorBox, "SizeGroup" ); - SizeGroup->setColumnLayout(0, Qt::Vertical ); - SizeGroup->layout()->setSpacing( 0 ); - SizeGroup->layout()->setMargin( 0 ); - QGridLayout* SizeGroupLayout = new QGridLayout (SizeGroup->layout()); - SizeGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); - SizeGroupLayout->setSpacing(6); - SizeGroupLayout->setMargin(11); + myTabBox->addTab( mySegmentationCursorBox, tr( "SEGMENTATION_CURSOR_TAB" ) ); - // Geometry Size - mySizeLabel = new QLabel( tr( "SIZE" ), SizeGroup ); - mySizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); - mySizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - SizeGroupLayout->addWidget( mySizeLabel, 0, 0 ); - SizeGroupLayout->addWidget( mySizeSpinBox, 0, 1 ); + // Gauss points pane + myGaussPointsBox = new QVBox( this ); + myGaussPointsBox->setMargin(11); + myGaussPointsBox->setSpacing(6); - // Color - QGroupBox* ColorGroup = new QGroupBox ( tr( "COLOR_TITLE" ), myOutsideCursorBox, "ColorGroup" ); - ColorGroup->setColumnLayout(0, Qt::Vertical ); - ColorGroup->layout()->setSpacing( 0 ); - ColorGroup->layout()->setMargin( 0 ); + // Inside Gauss points + QGroupBox* anInsideGroup = new QGroupBox( tr( "INSIDE_GAUSS_POINTS" ), myGaussPointsBox ); + anInsideGroup->setColumnLayout( 0, Qt::Vertical ); + anInsideGroup->layout()->setSpacing( 0 ); + anInsideGroup->layout()->setMargin( 0 ); - QGridLayout* ColorGroupLayout = new QGridLayout (ColorGroup->layout()); - ColorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); - ColorGroupLayout->setSpacing(6); - ColorGroupLayout->setMargin(11); + QGridLayout* anInsideGroupLayout = new QGridLayout( anInsideGroup->layout() ); + anInsideGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + anInsideGroupLayout->setSpacing(6); + anInsideGroupLayout->setMargin(11); - myColorLabel = new QLabel( tr( "COLOR" ), ColorGroup ); - myColorButton = new QPushButton( ColorGroup ); - myColorButton->setPaletteBackgroundColor( Qt::blue ); - myColorButton->setPaletteForegroundColor( Qt::blue ); + // Primitive + myInsidePrimitiveBox = new VVTK_PrimitiveBox( anInsideGroup ); + + // Size + myInsideSizeBox = new VVTK_SizeBox( anInsideGroup ); + myInsideSizeBox->setType( VVTK_SizeBox::Results ); - ColorGroupLayout->addWidget( myColorLabel, 0, 0 ); - ColorGroupLayout->addWidget( myColorButton, 0, 1 ); + anInsideGroupLayout->addWidget( myInsidePrimitiveBox, 0, 0 ); + anInsideGroupLayout->addWidget( myInsideSizeBox, 1, 0 ); - connect( myColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) ); + // Outside Gauss points + QGroupBox* anOutsideGroup = new QGroupBox( tr( "OUTSIDE_GAUSS_POINTS" ), myGaussPointsBox ); + anOutsideGroup->setColumnLayout( 0, Qt::Vertical ); + anOutsideGroup->layout()->setSpacing( 0 ); + anOutsideGroup->layout()->setMargin( 0 ); + QGridLayout* anOutsideGroupLayout = new QGridLayout( anOutsideGroup->layout() ); + anOutsideGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + anOutsideGroupLayout->setSpacing(6); + anOutsideGroupLayout->setMargin(11); + + // Primitive + myOutsidePrimitiveBox = new VVTK_PrimitiveBox( anOutsideGroup ); + + // Size + myOutsideSizeBox = new VVTK_SizeBox( anOutsideGroup ); + myOutsideSizeBox->setType( VVTK_SizeBox::Outside ); - myTabBox->addTab( myOutsideCursorBox, tr("OUTSIDE_CURSOR_TAB") ); - myTabBox->showPage( myOutsideCursorBox ); + anOutsideGroupLayout->addWidget( myOutsidePrimitiveBox, 0, 0 ); + anOutsideGroupLayout->addWidget( myOutsideSizeBox, 1, 0 ); + myTabBox->addTab( myGaussPointsBox, tr( "GAUSS_POINTS_TAB" ) ); + myTabBox->showPage( myGaussPointsBox ); // Common buttons =========================================================== @@ -317,16 +282,6 @@ VVTK_SegmentationCursorDlg::~VVTK_SegmentationCursorDlg() { } -void VVTK_SegmentationCursorDlg::AddActor( VISU_GaussPtsAct1* theActor ) -{ - theActor->SetOutsideCursorSettings( myOutsideCursorSettings.GetPointer() ); -} - -void VVTK_SegmentationCursorDlg::RemoveActor( VISU_GaussPtsAct1* theActor ) -{ - theActor->SetOutsideCursorSettings( NULL ); -} - void VVTK_SegmentationCursorDlg::SetWidget( VISU_ImplicitFunctionWidget* theWidget ) { myWidget = theWidget; @@ -352,98 +307,156 @@ void VVTK_SegmentationCursorDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject), void VVTK_SegmentationCursorDlg::UpdateSegmentation() { - float origin[3]; - myWidget->GetOrigin( origin ); - myXOriginSpinBox->setValue( origin[0] ); - myYOriginSpinBox->setValue( origin[1] ); - myZOriginSpinBox->setValue( origin[2] ); - - float normal[3]; - myWidget->GetNormal( normal ); - myDXDirectionSpinBox->setValue( normal[0] ); - myDYDirectionSpinBox->setValue( normal[1] ); - myDZDirectionSpinBox->setValue( normal[2] ); - - myDepthSpinBox->setValue( myWidget->Distance() ); + if( myIsPlaneSegmentation ) + { + myDirectionGroup->show(); + myDepthGroup->show(); + myRadiusGroup->hide(); + + float origin[3]; + myWidget->GetOrigin( origin ); + myXOriginSpinBox->setValue( origin[0] ); + myYOriginSpinBox->setValue( origin[1] ); + myZOriginSpinBox->setValue( origin[2] ); + + float normal[3]; + myWidget->GetNormal( normal ); + myDXDirectionSpinBox->setValue( normal[0] ); + myDYDirectionSpinBox->setValue( normal[1] ); + myDZDirectionSpinBox->setValue( normal[2] ); + + myDepthSpinBox->setValue( myWidget->Distance() ); + } + else + { + myDirectionGroup->hide(); + myDepthGroup->hide(); + myRadiusGroup->show(); + } } -void VVTK_SegmentationCursorDlg::onBrowseMainTexture() +void VVTK_SegmentationCursorDlg::UpdateInsideGaussPoints() { - QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; - QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this ); + int aPrimitiveType = VVTK_PrimitiveBox::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; + float anIncrement = 2.0; + + if( !myInsideCursorSettings->GetInitial() ) + { + myInsidePrimitiveBox->setPrimitiveType( myInsideCursorSettings->GetPrimitiveType() ); + myInsidePrimitiveBox->setClamp( myInsideCursorSettings->GetClamp() ); + myInsidePrimitiveBox->setMainTexture( myInsideMainTexture ); + myInsidePrimitiveBox->setAlphaTexture( myInsideAlphaTexture ); + myInsidePrimitiveBox->setAlphaThreshold( myInsideCursorSettings->GetAlphaThreshold() ); + + myInsideSizeBox->setMinSize( myInsideCursorSettings->GetMinSize() ); + myInsideSizeBox->setMaxSize( myInsideCursorSettings->GetMaxSize() ); + myInsideSizeBox->setMagnification( myInsideCursorSettings->GetMagnification() ); + myInsideSizeBox->setIncrement( myInsideCursorSettings->GetIncrement() ); - if( aFileName.isNull() ) return; + } - myMainTexture = aFileName; - myMainTextureLineEdit->setText( aFileName.section( '/', -1 ) ); -} + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); -void VVTK_SegmentationCursorDlg::onBrowseAlphaTexture() -{ - QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; - QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this ); + aPrimitiveType = aResourceMgr->integerValue( "VISU", "inside_point_sprite_primitive_type", aPrimitiveType ); + myInsidePrimitiveBox->setPrimitiveType( aPrimitiveType ); - if( aFileName.isNull() ) - return; + aClamp = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_clamp", aClamp ); + myInsidePrimitiveBox->setClamp( aClamp ); - myAlphaTexture = aFileName; - myAlphaTextureLineEdit->setText( aFileName.section( '/', -1 ) ); -} + aMainTexture = aResourceMgr->stringValue( "VISU", "inside_point_sprite_main_texture", aMainTexture ); + myInsidePrimitiveBox->setMainTexture( aMainTexture ); -void VVTK_SegmentationCursorDlg::onColorButtonPressed() -{ - QColor aColor = QColorDialog::getColor( myColorButton->paletteBackgroundColor(), this ); - if( aColor.isValid() ) - myColorButton->setPaletteBackgroundColor( aColor ); + anAlphaTexture = aResourceMgr->stringValue( "VISU", "inside_point_sprite_alpha_texture", anAlphaTexture ); + myInsidePrimitiveBox->setAlphaTexture( anAlphaTexture ); + + anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_alpha_threshold", anAlphaThreshold ); + myInsidePrimitiveBox->setAlphaThreshold( anAlphaThreshold ); + + aMinSize = aResourceMgr->integerValue( "VISU", "inside_point_sprite_min_size", aMinSize ); + myInsideSizeBox->setMinSize( aMinSize ); + + aMaxSize = aResourceMgr->integerValue( "VISU", "inside_point_sprite_max_size", aMaxSize ); + myInsideSizeBox->setMaxSize( aMaxSize ); + + aMagnification = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_magnification", aMagnification ); + myInsideSizeBox->setMagnification( aMagnification ); + + anIncrement = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_increment", anIncrement ); + myInsideSizeBox->setIncrement( anIncrement ); + + ApplyInsideGaussPoints(); } -void VVTK_SegmentationCursorDlg::UpdateOutsideCursor() +void VVTK_SegmentationCursorDlg::UpdateOutsideGaussPoints() { + int aPrimitiveType = VVTK_PrimitiveBox::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 aSize = 25; + bool aUniform = false; QColor aColor = Qt::blue; if( !myOutsideCursorSettings->GetInitial() ) { - myClampSpinBox->setValue( myOutsideCursorSettings->GetClamp() ); - myMainTextureLineEdit->setText( myMainTexture.section( '/', -1 ) ); - myAlphaTextureLineEdit->setText( myAlphaTexture.section( '/', -1 ) ); - myAlphaThresholdSpinBox->setValue( myOutsideCursorSettings->GetAlphaThreshold() ); - mySizeSpinBox->setValue( myOutsideCursorSettings->GetSize() ); + myOutsidePrimitiveBox->setPrimitiveType( myOutsideCursorSettings->GetPrimitiveType() ); + myOutsidePrimitiveBox->setClamp( myOutsideCursorSettings->GetClamp() ); + myOutsidePrimitiveBox->setMainTexture( myOutsideMainTexture ); + myOutsidePrimitiveBox->setAlphaTexture( myOutsideAlphaTexture ); + myOutsidePrimitiveBox->setAlphaThreshold( myOutsideCursorSettings->GetAlphaThreshold() ); + + myOutsideSizeBox->setOutsideSize( myOutsideCursorSettings->GetSize() ); + myOutsideSizeBox->setUniform( myOutsideCursorSettings->GetUniform() ); float* aColor = myOutsideCursorSettings->GetColor(); - myColorButton->setPaletteBackgroundColor( QColor( ( int )( aColor[0] * 255.0 ), - ( int )( aColor[1] * 255.0 ), - ( int )( aColor[2] * 255.0 ) ) ); + myOutsideSizeBox->setColor( QColor( ( int )( aColor[0] * 255.0 ), + ( int )( aColor[1] * 255.0 ), + ( int )( aColor[2] * 255.0 ) ) ); return; } SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + aPrimitiveType = aResourceMgr->integerValue( "VISU", "outside_point_sprite_primitive_type", aPrimitiveType ); + myOutsidePrimitiveBox->setPrimitiveType( aPrimitiveType ); + aClamp = aResourceMgr->doubleValue( "VISU", "outside_point_sprite_clamp", aClamp ); - myClampSpinBox->setValue( aClamp ); + myOutsidePrimitiveBox->setClamp( aClamp ); - myMainTexture = aResourceMgr->stringValue( "VISU", "outside_point_sprite_main_texture", aMainTexture ); - myMainTextureLineEdit->setText( myMainTexture.section( '/', -1 ) ); + aMainTexture = aResourceMgr->stringValue( "VISU", "outside_point_sprite_main_texture", aMainTexture ); + myOutsidePrimitiveBox->setMainTexture( aMainTexture ); - myAlphaTexture = aResourceMgr->stringValue( "VISU", "outside_point_sprite_alpha_texture", anAlphaTexture ); - myAlphaTextureLineEdit->setText( myAlphaTexture.section( '/', -1 ) ); + anAlphaTexture = aResourceMgr->stringValue( "VISU", "outside_point_sprite_alpha_texture", anAlphaTexture ); + myOutsidePrimitiveBox->setAlphaTexture( anAlphaTexture ); anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "outside_point_sprite_alpha_threshold", anAlphaThreshold ); - myAlphaThresholdSpinBox->setValue( anAlphaThreshold ); + myOutsidePrimitiveBox->setAlphaThreshold( anAlphaThreshold ); aSize = aResourceMgr->integerValue( "VISU", "outside_point_sprite_size", aSize ); - mySizeSpinBox->setValue( aSize ); + myOutsideSizeBox->setOutsideSize( aSize ); + + aUniform = aResourceMgr->booleanValue( "VISU", "outside_point_sprite_uniform", aUniform ); + myOutsideSizeBox->setUniform( aUniform ); aColor = aResourceMgr->colorValue( "VISU", "outside_point_sprite_color", aColor ); - myColorButton->setPaletteBackgroundColor( aColor ); + myOutsideSizeBox->setColor( aColor ); - ApplyOutsideCursor(); + ApplyOutsideGaussPoints(); +} + +VISU_InsideCursorSettings* VVTK_SegmentationCursorDlg::GetInsideCursorSettings() +{ + return myInsideCursorSettings.GetPointer(); } VISU_OutsideCursorSettings* VVTK_SegmentationCursorDlg::GetOutsideCursorSettings() @@ -451,16 +464,30 @@ VISU_OutsideCursorSettings* VVTK_SegmentationCursorDlg::GetOutsideCursorSettings return myOutsideCursorSettings.GetPointer(); } -vtkImageData* VVTK_SegmentationCursorDlg::MakeImageData( const QString& theMainTexture, +vtkImageData* VVTK_SegmentationCursorDlg::MakeImageData( bool theInside, + const QString& theMainTexture, const QString& theAlphaTexture ) { - //bool updateMainTexture = myMainTexture != theMainTexture; - //bool updateAlphaTexture = myAlphaTexture != theAlphaTexture; - //if( !updateMainTexture && !updateAlphaTexture ) - // return 0; + if( theInside ) + { + bool updateMainTexture = myInsideMainTexture != theMainTexture; + bool updateAlphaTexture = myInsideAlphaTexture != theAlphaTexture; + if( !updateMainTexture && !updateAlphaTexture ) + return 0; + + myInsideMainTexture = theMainTexture; + myInsideAlphaTexture = theAlphaTexture; + } + else + { + bool updateMainTexture = myOutsideMainTexture != theMainTexture; + bool updateAlphaTexture = myOutsideAlphaTexture != theAlphaTexture; + if( !updateMainTexture && !updateAlphaTexture ) + return 0; - //myMainTexture = theMainTexture; - //myAlphaTexture = theAlphaTexture; + myOutsideMainTexture = theMainTexture; + myOutsideAlphaTexture = theAlphaTexture; + } QString mainTextureFormat = theMainTexture.section( '.', -1 ); QString mainTextureVTI = theMainTexture.section( '.', 0, -2 ) + ".vti"; @@ -488,40 +515,79 @@ void VVTK_SegmentationCursorDlg::onClickApply() if( myTabBox->currentPage() == mySegmentationCursorBox ) ApplySegmentationCursor(); else - ApplyOutsideCursor(); + { + ApplyInsideGaussPoints(); + ApplyOutsideGaussPoints(); + } } void VVTK_SegmentationCursorDlg::ApplySegmentationCursor() { - float origin[3]; - origin[0] = myXOriginSpinBox->value(); - origin[1] = myYOriginSpinBox->value(); - origin[2] = myZOriginSpinBox->value(); - myWidget->SetOrigin( origin ); - - float normal[3]; - normal[0] = myDXDirectionSpinBox->value(); - normal[1] = myDYDirectionSpinBox->value(); - normal[2] = myDZDirectionSpinBox->value(); - myWidget->SetNormal( normal ); - - myWidget->SetDistance( myDepthSpinBox->value() ); - - myWidget->InvokeEvent(vtkCommand::EndInteractionEvent,NULL); - myWidget->GetInteractor()->Render(); + if( myIsPlaneSegmentation ) + { + float origin[3]; + origin[0] = myXOriginSpinBox->value(); + origin[1] = myYOriginSpinBox->value(); + origin[2] = myZOriginSpinBox->value(); + myWidget->SetOrigin( origin ); + + float normal[3]; + normal[0] = myDXDirectionSpinBox->value(); + normal[1] = myDYDirectionSpinBox->value(); + normal[2] = myDZDirectionSpinBox->value(); + myWidget->SetNormal( normal ); + + myWidget->SetDistance( myDepthSpinBox->value() ); + + myWidget->InvokeEvent(vtkCommand::EndInteractionEvent,NULL); + myWidget->GetInteractor()->Render(); + } + else + { + + } } -void VVTK_SegmentationCursorDlg::ApplyOutsideCursor() +void VVTK_SegmentationCursorDlg::ApplyInsideGaussPoints() { - vtkImageData* aTexture = this->MakeImageData( myMainTexture, myAlphaTexture ); + QString anInsideMainTexture = myInsidePrimitiveBox->getMainTexture(); + QString anInsideAlphaTexture = myInsidePrimitiveBox->getAlphaTexture(); + vtkImageData* aTexture = this->MakeImageData( true, anInsideMainTexture, anInsideAlphaTexture ); + + if( aTexture ) + myInsideCursorSettings->SetTexture( aTexture ); + + myInsideCursorSettings->SetInitial( false ); + myInsideCursorSettings->SetPrimitiveType( myInsidePrimitiveBox->getPrimitiveType() ); + myInsideCursorSettings->SetClamp( myInsidePrimitiveBox->getClamp() ); + myInsideCursorSettings->SetAlphaThreshold( myInsidePrimitiveBox->getAlphaThreshold() ); + + myInsideCursorSettings->SetMinSize( myInsideSizeBox->getMinSize() ); + myInsideCursorSettings->SetMaxSize( myInsideSizeBox->getMaxSize() ); + myInsideCursorSettings->SetMagnification( myInsideSizeBox->getMagnification() ); + myInsideCursorSettings->SetIncrement( myInsideSizeBox->getIncrement() ); + + myInsideCursorSettings->InvokeEvent(VISU::UpdateInsideSettingsEvent,NULL); +} + +void VVTK_SegmentationCursorDlg::ApplyOutsideGaussPoints() +{ + QString anOutsideMainTexture = myOutsidePrimitiveBox->getMainTexture(); + QString anOutsideAlphaTexture = myOutsidePrimitiveBox->getAlphaTexture(); + vtkImageData* aTexture = this->MakeImageData( false, anOutsideMainTexture, anOutsideAlphaTexture ); + + if( aTexture ) + myOutsideCursorSettings->SetTexture( aTexture ); myOutsideCursorSettings->SetInitial( false ); - myOutsideCursorSettings->SetClamp( myClampSpinBox->value() ); - myOutsideCursorSettings->SetTexture( aTexture ); - myOutsideCursorSettings->SetAlphaThreshold( myAlphaThresholdSpinBox->value() ); - myOutsideCursorSettings->SetSize( mySizeSpinBox->value() ); + myOutsideCursorSettings->SetPrimitiveType( myOutsidePrimitiveBox->getPrimitiveType() ); + myOutsideCursorSettings->SetClamp( myOutsidePrimitiveBox->getClamp() ); + myOutsideCursorSettings->SetAlphaThreshold( myOutsidePrimitiveBox->getAlphaThreshold() ); + + myOutsideCursorSettings->SetSize( myOutsideSizeBox->getOutsideSize() ); + myOutsideCursorSettings->SetUniform( myOutsideSizeBox->getUniform() ); - QColor aButtonColor = myColorButton->paletteBackgroundColor(); + QColor aButtonColor = myOutsideSizeBox->getColor(); float aColor[3]; aColor[0] = aButtonColor.red() / 255.0; aColor[1] = aButtonColor.green() / 255.0; @@ -533,12 +599,14 @@ void VVTK_SegmentationCursorDlg::ApplyOutsideCursor() void VVTK_SegmentationCursorDlg::onClickClose() { - myAction->setOn( false ); + myPlaneAction->setOn( false ); + mySphereAction->setOn( false ); reject(); } void VVTK_SegmentationCursorDlg::done( int r ) { - myAction->setOn( false ); + myPlaneAction->setOn( false ); + mySphereAction->setOn( false ); QDialog::done( r ); } diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.h b/src/VVTK/VVTK_SegmentationCursorDlg.h index 1e63fcad..a014eeaa 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.h +++ b/src/VVTK/VVTK_SegmentationCursorDlg.h @@ -25,15 +25,20 @@ class QLineEdit; class QPushButton; class QRadioButton; class QTabWidget; +class QGroupBox; class QVBox; class QtxAction; class QtxDblSpinBox; class VISU_GaussPtsAct1; +class VISU_InsideCursorSettings; class VISU_OutsideCursorSettings; class VISU_ImplicitFunctionWidget; +class VVTK_PrimitiveBox; +class VVTK_SizeBox; + class VVTK_SegmentationCursorDlg : public QDialog { Q_OBJECT @@ -42,23 +47,27 @@ public: VVTK_SegmentationCursorDlg( QWidget* parent = 0, const char* name = 0 ); ~VVTK_SegmentationCursorDlg(); - void AddActor( VISU_GaussPtsAct1* ); - void RemoveActor( VISU_GaussPtsAct1* ); - void SetWidget( VISU_ImplicitFunctionWidget* ); - void SetAction( QtxAction* theAction ) { myAction = theAction; } + void SetPlaneAction( QtxAction* theAction ) { myPlaneAction = theAction; } + void SetSphereAction( QtxAction* theAction ) { mySphereAction = theAction; } - void UpdateSegmentation(); + bool GetIsPlaneSegmentation() const { return myIsPlaneSegmentation; } + void SetIsPlaneSegmentation( bool on ) { myIsPlaneSegmentation = on; } - void UpdateOutsideCursor(); + void UpdateSegmentation(); + void UpdateInsideGaussPoints(); + void UpdateOutsideGaussPoints(); + VISU_InsideCursorSettings* GetInsideCursorSettings(); VISU_OutsideCursorSettings* GetOutsideCursorSettings(); protected: void ApplySegmentationCursor(); - void ApplyOutsideCursor(); + void ApplyInsideGaussPoints(); + void ApplyOutsideGaussPoints(); - vtkImageData* MakeImageData( const QString& theMainTexture, + vtkImageData* MakeImageData( bool theInside, + const QString& theMainTexture, const QString& theAlphaTexture ); private: @@ -73,49 +82,54 @@ protected slots: void onClickApply(); void onClickClose(); - void onBrowseMainTexture(); - void onBrowseAlphaTexture(); - void onColorButtonPressed(); - private: QTabWidget* myTabBox; // Segmentation cursor QVBox* mySegmentationCursorBox; + QGroupBox* myOriginGroup; QtxDblSpinBox* myXOriginSpinBox; QtxDblSpinBox* myYOriginSpinBox; QtxDblSpinBox* myZOriginSpinBox; + QGroupBox* myDirectionGroup; QtxDblSpinBox* myDXDirectionSpinBox; QtxDblSpinBox* myDYDirectionSpinBox; QtxDblSpinBox* myDZDirectionSpinBox; + QGroupBox* myDepthGroup; QtxDblSpinBox* myDepthSpinBox; + QGroupBox* myRadiusGroup; + QtxDblSpinBox* myRadiusSpinBox; + QtxDblSpinBox* myRatioSpinBox; + + bool myIsPlaneSegmentation; + float myPriority; vtkSmartPointer myEventCallbackCommand; VISU_ImplicitFunctionWidget* myWidget; - QtxAction* myAction; + QtxAction* myPlaneAction; + QtxAction* mySphereAction; - // Outside cursor - QVBox* myOutsideCursorBox; + // Gauss Points + QVBox* myGaussPointsBox; - QtxDblSpinBox* myClampSpinBox; + VVTK_PrimitiveBox* myInsidePrimitiveBox; + VVTK_SizeBox* myInsideSizeBox; - QLineEdit* myMainTextureLineEdit; - QLineEdit* myAlphaTextureLineEdit; - QtxDblSpinBox* myAlphaThresholdSpinBox; + QString myInsideMainTexture; + QString myInsideAlphaTexture; - QLabel* mySizeLabel; - QtxDblSpinBox* mySizeSpinBox; + vtkSmartPointer myInsideCursorSettings; - QLabel* myColorLabel; - QPushButton* myColorButton; + VVTK_PrimitiveBox* myOutsidePrimitiveBox; + VVTK_SizeBox* myOutsideSizeBox; - QString myMainTexture; - QString myAlphaTexture; + QString myOutsideMainTexture; + QString myOutsideAlphaTexture; vtkSmartPointer myOutsideCursorSettings; }; diff --git a/src/VVTK/VVTK_SizeBox.cxx b/src/VVTK/VVTK_SizeBox.cxx new file mode 100644 index 00000000..a6d545f7 --- /dev/null +++ b/src/VVTK/VVTK_SizeBox.cxx @@ -0,0 +1,307 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VVTK_SizeBox.cxx +// Author : Oleg UVAROV +// Module : VISU + +#include "VVTK_SizeBox.h" + +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" + +#include "QtxDblSpinBox.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : + QVBox( parent ) +{ + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + + layout()->setSpacing( 0 ); + layout()->setMargin( 0 ); + + // Size + QGroupBox* SizeGroup = new QGroupBox ( tr( "SIZE_TITLE" ), this, "SizeGroup" ); + SizeGroup->setColumnLayout(0, Qt::Vertical ); + SizeGroup->layout()->setSpacing( 0 ); + SizeGroup->layout()->setMargin( 0 ); + + QGridLayout* SizeGroupLayout = new QGridLayout (SizeGroup->layout()); + SizeGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + SizeGroupLayout->setSpacing(6); + SizeGroupLayout->setMargin(11); + + // Outside Size + myOutsideSizeLabel = new QLabel( tr( "OUTSIDE_SIZE" ), SizeGroup ); + myOutsideSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); + myOutsideSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + SizeGroupLayout->addWidget( myOutsideSizeLabel, 0, 0 ); + SizeGroupLayout->addWidget( myOutsideSizeSpinBox, 0, 1 ); + + // Geometry Size + myGeomSizeLabel = new QLabel( tr( "GEOM_SIZE" ), SizeGroup ); + myGeomSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); + myGeomSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + SizeGroupLayout->addWidget( myGeomSizeLabel, 0, 0 ); + SizeGroupLayout->addWidget( myGeomSizeSpinBox, 0, 1 ); + + // Min Size + myMinSizeLabel = new QLabel( tr( "MIN_SIZE" ), SizeGroup ); + myMinSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); + myMinSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + SizeGroupLayout->addWidget( myMinSizeLabel, 1, 0 ); + SizeGroupLayout->addWidget( myMinSizeSpinBox, 1, 1 ); + + // Max Size + myMaxSizeLabel = new QLabel( tr( "MAX_SIZE" ), SizeGroup ); + myMaxSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); + myMaxSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + SizeGroupLayout->addWidget( myMaxSizeLabel, 1, 2 ); + SizeGroupLayout->addWidget( myMaxSizeSpinBox, 1, 3 ); + + // Magnification + myMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), SizeGroup ); + myMagnificationSpinBox = new QtxDblSpinBox( 10, 1000, 10, SizeGroup ); + myMagnificationSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + SizeGroupLayout->addWidget( myMagnificationLabel, 2, 0 ); + SizeGroupLayout->addWidget( myMagnificationSpinBox, 2, 1 ); + + // Increment + myIncrementLabel = new QLabel( tr( "INCREMENT" ), SizeGroup ); + myIncrementSpinBox = new QtxDblSpinBox( 0.01, 10, 0.1, SizeGroup ); + myIncrementSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + SizeGroupLayout->addWidget( myIncrementLabel, 2, 2 ); + SizeGroupLayout->addWidget( myIncrementSpinBox, 2, 3 ); + + + // Color + myColorGroup = new QGroupBox ( tr( "COLOR_TITLE" ), this, "ColorGroup" ); + myColorGroup->setColumnLayout(0, Qt::Vertical ); + myColorGroup->layout()->setSpacing( 0 ); + myColorGroup->layout()->setMargin( 0 ); + + QGridLayout* ColorGroupLayout = new QGridLayout (myColorGroup->layout()); + ColorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); + ColorGroupLayout->setSpacing(6); + ColorGroupLayout->setMargin(11); + + myUniformCheckBox = new QCheckBox( tr( "UNIFORM_COLOR" ), myColorGroup ); + + myColorLabel = new QLabel( tr( "COLOR" ), myColorGroup ); + myColorButton = new QPushButton( myColorGroup ); + + ColorGroupLayout->addWidget( myUniformCheckBox, 0, 0 ); + ColorGroupLayout->addWidget( myColorLabel, 0, 1 ); + ColorGroupLayout->addWidget( myColorButton, 0, 2 ); + + connect( myUniformCheckBox, SIGNAL( toggled( bool ) ), myColorButton, SLOT( setEnabled( bool ) ) ); + connect( myColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) ); + + setType( VVTK_SizeBox::Results ); +} + +void VVTK_SizeBox::onToggleResults() +{ + myType = VVTK_SizeBox::Results; + + myOutsideSizeLabel->hide(); + myOutsideSizeSpinBox->hide(); + + myGeomSizeLabel->hide(); + myGeomSizeSpinBox->hide(); + + myMinSizeLabel->show(); + myMinSizeSpinBox->show(); + + myMaxSizeLabel->show(); + myMaxSizeSpinBox->show(); + + myColorGroup->hide(); +} + +void VVTK_SizeBox::onToggleGeometry() +{ + myType = VVTK_SizeBox::Geometry; + + myOutsideSizeLabel->hide(); + myOutsideSizeSpinBox->hide(); + + myGeomSizeLabel->show(); + myGeomSizeSpinBox->show(); + + myMinSizeLabel->hide(); + myMinSizeSpinBox->hide(); + + myMaxSizeLabel->hide(); + myMaxSizeSpinBox->hide(); + + myColorGroup->show(); + + myUniformCheckBox->hide(); +} + +void VVTK_SizeBox::onToggleOutside() +{ + myType = VVTK_SizeBox::Outside; + + myOutsideSizeLabel->show(); + myOutsideSizeSpinBox->show(); + + myGeomSizeLabel->hide(); + myGeomSizeSpinBox->hide(); + + myMinSizeLabel->hide(); + myMinSizeSpinBox->hide(); + + myMaxSizeLabel->hide(); + myMaxSizeSpinBox->hide(); + + myMagnificationLabel->hide(); + myMagnificationSpinBox->hide(); + + myIncrementLabel->hide(); + myIncrementSpinBox->hide(); + + myColorGroup->show(); + + myUniformCheckBox->show(); +} + +void VVTK_SizeBox::setType( int theType ) +{ + myType = theType; + + switch( myType ) + { + case VVTK_SizeBox::Results : onToggleResults(); break; + case VVTK_SizeBox::Geometry : onToggleGeometry(); break; + case VVTK_SizeBox::Outside : onToggleOutside(); break; + default : break; + } +} + +float VVTK_SizeBox::getOutsideSize() const +{ + return myOutsideSizeSpinBox->value(); +} + +void VVTK_SizeBox::setOutsideSize( float theOutsideSize ) +{ + myOutsideSizeSpinBox->setValue( theOutsideSize ); +} + +float VVTK_SizeBox::getGeomSize() const +{ + return myGeomSizeSpinBox->value(); +} + +void VVTK_SizeBox::setGeomSize( float theGeomSize ) +{ + myGeomSizeSpinBox->setValue( theGeomSize ); +} + +float VVTK_SizeBox::getMinSize() const +{ + return myMinSizeSpinBox->value(); +} + +void VVTK_SizeBox::setMinSize( float theMinSize ) +{ + myMinSizeSpinBox->setValue( theMinSize ); +} + +float VVTK_SizeBox::getMaxSize() const +{ + return myMaxSizeSpinBox->value(); +} + +void VVTK_SizeBox::setMaxSize( float theMaxSize ) +{ + myMaxSizeSpinBox->setValue( theMaxSize ); +} + +float VVTK_SizeBox::getMagnification() const +{ + return myMagnificationSpinBox->value(); +} + +void VVTK_SizeBox::setMagnification( float theMagnification ) +{ + myMagnificationSpinBox->setValue( theMagnification ); +} + +float VVTK_SizeBox::getIncrement() const +{ + return myIncrementSpinBox->value(); +} + +void VVTK_SizeBox::setIncrement( float theIncrement ) +{ + myIncrementSpinBox->setValue( theIncrement ); +} + +bool VVTK_SizeBox::getUniform() const +{ + return myUniformCheckBox->isChecked(); +} + +void VVTK_SizeBox::setUniform( bool theUniform ) +{ + myUniformCheckBox->setChecked( theUniform ); + myColorButton->setEnabled( theUniform ); +} + +QColor VVTK_SizeBox::getColor() const +{ + return myColorButton->paletteBackgroundColor(); +} + +void VVTK_SizeBox::setColor( const QColor& theColor ) +{ + myColorButton->setPaletteBackgroundColor( theColor ); +} + +void VVTK_SizeBox::onColorButtonPressed() +{ + QColor aColor = QColorDialog::getColor( myColorButton->paletteBackgroundColor(), this ); + if( aColor.isValid() ) + myColorButton->setPaletteBackgroundColor( aColor ); +} diff --git a/src/VVTK/VVTK_SizeBox.h b/src/VVTK/VVTK_SizeBox.h new file mode 100644 index 00000000..69a8d4a9 --- /dev/null +++ b/src/VVTK/VVTK_SizeBox.h @@ -0,0 +1,117 @@ +// VISU VISUGUI : GUI of VISU component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : VVTK_SizeBox.h +// Author : Oleg UVAROV +// Module : VISU + +#ifndef VVTK_SIZEBOX_H +#define VVTK_SIZEBOX_H + +#include + +class QLabel; +class QLineEdit; +class QPushButton; +class QCheckBox; +class QGroupBox; + +class QtxDblSpinBox; + +class VVTK_SizeBox : public QVBox +{ + Q_OBJECT + +public: + enum { Results = 0, Geometry, Outside }; + +public: + VVTK_SizeBox( QWidget* ); + ~VVTK_SizeBox() {} + +public: + int getType() const { return myType; } + void setType( int ); + + float getOutsideSize() const; + void setOutsideSize( float ); + + float getGeomSize() const; + void setGeomSize( float ); + + float getMinSize() const; + void setMinSize( float ); + + float getMaxSize() const; + void setMaxSize( float ); + + float getMagnification() const; + void setMagnification( float ); + + float getIncrement() const; + void setIncrement( float ); + + bool getUniform() const; + void setUniform( bool ); + + QColor getColor() const; + void setColor( const QColor& ); + +protected slots: + void onToggleResults(); + void onToggleGeometry(); + void onToggleOutside(); + + void onColorButtonPressed(); + +private: + int myType; + + QLabel* myOutsideSizeLabel; + QtxDblSpinBox* myOutsideSizeSpinBox; + + QLabel* myGeomSizeLabel; + QtxDblSpinBox* myGeomSizeSpinBox; + + QLabel* myMinSizeLabel; + QtxDblSpinBox* myMinSizeSpinBox; + + QLabel* myMaxSizeLabel; + QtxDblSpinBox* myMaxSizeSpinBox; + + QLabel* myMagnificationLabel; + QtxDblSpinBox* myMagnificationSpinBox; + + QLabel* myIncrementLabel; + QtxDblSpinBox* myIncrementSpinBox; + + QCheckBox* myUniformCheckBox; + + QGroupBox* myColorGroup; + QLabel* myColorLabel; + QPushButton* myColorButton; +}; + + + +#endif diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx index b8561daa..d26ba845 100755 --- a/src/VVTK/VVTK_ViewWindow.cxx +++ b/src/VVTK/VVTK_ViewWindow.cxx @@ -66,6 +66,7 @@ VVTK_ViewWindow //aSplitter->setChildrenCollapsible(true); VISU_ImplicitFunctionWidget* anImplicitFunctionWidget = NULL; + VISU_InsideCursorSettings* anInsideCursorSettings = NULL; VISU_OutsideCursorSettings* anOutsideCursorSettings = NULL; VISU_PickingSettings* aPickingSettings = NULL; SVTK_Selector* aSelector = SVTK_Selector::New(); @@ -74,6 +75,7 @@ VVTK_ViewWindow "VVTK_MainWindow", aResourceMgr); + anInsideCursorSettings = myMainWindow1->GetInsideCursorSettings(); anOutsideCursorSettings = myMainWindow1->GetOutsideCursorSettings(); aPickingSettings = myMainWindow1->GetPickingSettings(); @@ -88,6 +90,7 @@ VVTK_ViewWindow VVTK_Renderer1* aRenderer = VVTK_Renderer1::New(); aRenderer->Initialize(aDevice,aSelector); anImplicitFunctionWidget = aRenderer->GetImplicitFunctionWidget(); + aRenderer->SetInsideCursorSettings(anInsideCursorSettings); aRenderer->SetOutsideCursorSettings(anOutsideCursorSettings); aRenderer->SetPickingSettings(aPickingSettings); @@ -121,6 +124,7 @@ VVTK_ViewWindow VVTK_Renderer2* aRenderer = VVTK_Renderer2::New(); aRenderer->Initialize(aDevice,aSelector); aRenderer->SetImplicitFunctionWidget(anImplicitFunctionWidget); + aRenderer->SetInsideCursorSettings(anInsideCursorSettings); aRenderer->SetPickingSettings(aPickingSettings); anIteractor->Initialize(aDevice,aRenderer,aSelector);