#include <vtkGeometryFilter.h>
#include <vtkImageData.h>
#include <vtkWarpVector.h>
+#include <vtkGlyph3D.h>
+#include <vtkSphereSource.h>
//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_GaussPointsPL);
::VISU_GaussPointsPL():
myIsDeformed(false),
myScaleFactor(0.0),
- myPrimitiveType(0),
- myClamp(200.0),
- mySize(10),
- myMinSize(3),
- myMaxSize(33),
- myMagnification(100),
- myMagnificationIncrement(2),
- myAlphaThreshold(0.1)
+ myResolution( 8 ),
+ myMagnificationIncrement(2)
{
myExtractGeometry->SetExtractInside(0);
myWarpVector = vtkWarpVector::New();
myCellDataToPointData = vtkCellDataToPointData::New();
myCellDataToPointData->SetPassCellData(true);
+
+ myGlyph = vtkGlyph3D::New();
+ mySphereSource = vtkSphereSource::New();
}
void
SetMagnification(aPipeLine->GetMagnification());
SetMagnificationIncrement(aPipeLine->GetMagnificationIncrement());
SetAlphaThreshold(aPipeLine->GetAlphaThreshold());
+ SetResolution(aPipeLine->GetResolution());
SetIsDeformed( aPipeLine->GetIsDeformed() );
SetScale( aPipeLine->GetScale() );
myCellDataToPointData->SetInput( myFieldTransform->GetUnstructuredGridOutput() );
+ // Deformed Shape
if( myIsDeformed )
{
myWarpVector->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() );
myGeomFilter->SetInput( myWarpVector->GetOutput() );
}
else
- {
myGeomFilter->SetInput( myCellDataToPointData->GetUnstructuredGridOutput() );
- }
- myPSMapper->SetInput( myGeomFilter->GetOutput() );
+ // Geometrical Sphere
+ if( GetPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere )
+ {
+ myGlyph->SetInput( myGeomFilter->GetOutput() );
+ myGlyph->SetScaleModeToScaleByScalar();
+ myGlyph->SetColorModeToColorByScalar();
+ //myGlyph->SetScaleFactor( 5 );
+ myGlyph->ClampingOn();
+
+ mySphereSource->SetRadius( GetMagnification() * GetAverageCellSize() / 2. );
+ myGlyph->SetSource( mySphereSource->GetOutput() );
+
+ myPSMapper->SetInput( myGlyph->GetOutput() );
+ }
+ else
+ myPSMapper->SetInput( myGeomFilter->GetOutput() );
VISU_ScalarMapPL::Init();
GetSourceRange(mySourceScalarRange);
myDeltaScalarRange = mySourceScalarRange[1] - mySourceScalarRange[0];
+ SetAverageCellSize( VISU_DeformedShapePL::GetScaleFactor( GetParentMesh() ) );
+
vtkMapper* aMapper = GetMapper();
vtkDataSet* aDataSet = aMapper->GetInput();
- //vtkDataSet* aDataSet = GetParentMesh();
- myAverageCellSize = VISU_DeformedShapePL::GetScaleFactor(aDataSet);
-
vtkCellData* aCellData = aDataSet->GetCellData();
myScalarArray = aCellData->GetScalars();
myWarpVector->Delete();
myCellDataToPointData->Delete();
+
+ myGlyph->UnRegisterAllOutputs();
+ myGlyph->Delete();
+
+ mySphereSource->Delete();
}
//----------------------------------------------------------------------------
VISU_GaussPointsPL
::SetPrimitiveType(int thePrimitiveType)
{
- myPrimitiveType = thePrimitiveType;
- myPSMapper->SetPointSpritePrimitiveType( thePrimitiveType );
-
+ myPSMapper->SetPrimitiveType( thePrimitiveType );
Modified();
}
+//----------------------------------------------------------------------------
+int
+VISU_GaussPointsPL
+::GetPrimitiveType()
+{
+ return myPSMapper->GetPrimitiveType();
+}
+
//----------------------------------------------------------------------------
float
VISU_GaussPointsPL
VISU_GaussPointsPL
::SetClamp(float theClamp)
{
- myClamp = theClamp;
myPSMapper->SetPointSpriteClamp( theClamp );
-
Modified();
}
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetClamp()
+{
+ return myPSMapper->GetPointSpriteClamp();
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetSize(float theSize)
{
- mySize = theSize;
- myPSMapper->SetPointSpriteSize( 1000.0 * myAverageCellSize * mySize / 100.0 );
-
+ myPSMapper->SetPointSpriteSize( theSize );
Modified();
}
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetSize()
+{
+ return myPSMapper->GetPointSpriteSize();
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
-::SetMinSize(float theMinSize)
+::UpdateGlyphRange()
{
- myMinSize = theMinSize;
- myPSMapper->SetPointSpriteMinSize( 1000.0 * myAverageCellSize * myMinSize / 100.0 );
+ float aScalarRange[2];
+ GetSourceRange( aScalarRange );
+
+ float aMinSize = GetMinSize();
+ float aMaxSize = GetMaxSize();
+ float aRange = ( aScalarRange[1] - aScalarRange[0] ) / ( aMaxSize - aMinSize );
+ float aMinRange = aScalarRange[0] - aMinSize * aRange;
+ float aMaxRange = aMinRange + aRange;
+
+ myGlyph->SetRange( aMinRange, aMaxRange );
+}
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetMinSize(float theMinSize)
+{
+ myPSMapper->SetPointSpriteMinSize( theMinSize );
+ UpdateGlyphRange();
Modified();
}
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetMinSize()
+{
+ return myPSMapper->GetPointSpriteMinSize();
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetMaxSize(float theMaxSize)
{
- myMaxSize = theMaxSize;
- myPSMapper->SetPointSpriteMaxSize( 1000.0 * myAverageCellSize * myMaxSize / 100.0 );
-
+ myPSMapper->SetPointSpriteMaxSize( theMaxSize );
+ UpdateGlyphRange();
Modified();
}
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetMaxSize()
+{
+ return myPSMapper->GetPointSpriteMaxSize();
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::SetMagnification(float theMagnification)
{
- myMagnification = theMagnification;
- myPSMapper->SetPointSpriteMagnification( theMagnification / 100.0 );
-
+ myPSMapper->SetPointSpriteMagnification( theMagnification );
Modified();
}
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetMagnification()
+{
+ return myPSMapper->GetPointSpriteMagnification();
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
VISU_GaussPointsPL
::SetAlphaThreshold(float theAlphaThreshold)
{
- myAlphaThreshold = theAlphaThreshold;
myPSMapper->SetPointSpriteAlphaThreshold( theAlphaThreshold );
-
Modified();
}
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetAlphaThreshold()
+{
+ return myPSMapper->GetPointSpriteAlphaThreshold();
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetResolution(int theResolution)
+{
+ myResolution = theResolution;
+ mySphereSource->SetThetaResolution( myResolution );
+ mySphereSource->SetPhiResolution( myResolution );
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
VISU_GaussPointsPL
::GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray)
{
- float aMaxSize = myAverageCellSize*myMaxSize/100.0;
- float aMinSize = myAverageCellSize*myMinSize/100.0;
+ float aMaxSize = GetAverageCellSize() * GetMaxSize();
+ float aMinSize = GetAverageCellSize() * GetMinSize();
float aDelta = aMaxSize - aMinSize;
float aVal = theScalarArray->GetTuple1(theID);
VISU_GaussPointsPL
::GetMaxPointSize()
{
- return myAverageCellSize*myMaxSize/100.0;
+ return GetAverageCellSize() * GetMaxSize();
}
//----------------------------------------------------------------------------
return GetPointSize(theID,aScalarArray);
}
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetAverageCellSize(float theAverageCellSize)
+{
+ myPSMapper->SetAverageCellSize( theAverageCellSize );
+ Modified();
+}
+
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetAverageCellSize()
+{
+ return myPSMapper->GetAverageCellSize();
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
class VISU_OpenGLPointSpriteMapper;
class vtkGeometryFilter;
+class vtkGlyph3D;
+class vtkSphereSource;
class vtkDataArray;
class vtkImageData;
class vtkPointSet;
void
SetIsColored(bool theIsColored);
+ //! Set type of the primitives.
void
SetPrimitiveType(int thePrimitiveType);
+ //! Get type of the primitives.
int
- GetPrimitiveType() { return myPrimitiveType; }
+ GetPrimitiveType();
//! Get the maximum Point Sprite size, which is supported by hardware.
float
//! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteClamp, float).
float
- GetClamp() { return myClamp; }
+ GetClamp();
//! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteSize.
void
//! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteSize, float).
float
- GetSize() { return mySize; }
+ GetSize();
//! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
void
//! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMinSize, float).
float
- GetMinSize() { return myMinSize; }
+ GetMinSize();
//! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize.
void
//! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMaxSize, float).
float
- GetMaxSize() { return myMaxSize; }
+ GetMaxSize();
//! Redirect the request to VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification.
void
//! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteMagnification, float).
float
- GetMagnification() { return myMagnification; }
+ GetMagnification();
//! Set the increment of changing Magnification parameter.
void
//! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(PointSpriteAlphaThreshold, float).
float
- GetAlphaThreshold() { return myAlphaThreshold; }
+ GetAlphaThreshold();
+
+ //! Set resolution of the Geometrical Sphere.
+ void
+ SetResolution(int theResolution);
+
+ //! Get resolution of the Geometrical Sphere.
+ int
+ GetResolution() { return myResolution; }
//! Method for changing the Magnification parameter.
void
float
GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkSetMacro(AverageCellSize, float).
+ void
+ SetAverageCellSize(float AverageCellSize);
+
+ //! Redirect the request to VISU_OpenGLPointSpriteMapper.vtkGetMacro(AverageCellSize, float).
+ float
+ GetAverageCellSize();
+
+ //! Update scalar range of the glyph.
+ void
+ UpdateGlyphRange();
+
//! Set image data for the Point Sprite texture.
void
SetImageData(vtkImageData* theImageData);
virtual void SetMapScale( float theMapScale = 1.0 );
protected:
- vtkPointSet* doHook();
-
bool myIsDeformed;
float myScaleFactor;
vtkWarpVector *myWarpVector;
vtkCellDataToPointData* myCellDataToPointData;
- std::vector<VTKViewer_PassThroughFilter*> myPassFilter;
+ vtkGlyph3D* myGlyph;
+ vtkSphereSource* mySphereSource;
+ int myResolution;
protected:
VISU_OpenGLPointSpriteMapper* myPSMapper;
- vtkGeometryFilter* myGeomFilter;
VISU::PGaussPtsIDMapper myGaussPtsIDMapper;
+ vtkGeometryFilter* myGeomFilter;
+
vtkDataArray *myScalarArray;
float mySourceScalarRange[2];
float myDeltaScalarRange;
- float myAverageCellSize;
int myPrimitiveType;
- float myClamp;
- float mySize;
- float myMinSize;
- float myMaxSize;
- float myMagnification;
float myMagnificationIncrement;
- float myAlphaThreshold;
};
#endif
this->TotalCells = 0;
this->ExtensionsInitialized = 0;
this->DefaultPointSize = 20.0;
+ this->AverageCellSize = 0.0;
this->UsePointSprites = true;
this->UseTextures = true;
this->UseShader = true;
- this->PointSpriteMode = 0;
+ this->PrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite;
- this->PointSpritePrimitiveType = 0;
+ this->PointSpriteMode = 0;
- this->PointSpriteClamp = 100.0;
- this->PointSpriteSize = 30.0;
- this->PointSpriteMinSize = 15.0;
- this->PointSpriteMaxSize = 50.0;
- this->PointSpriteMagnification = 1.0;
+ this->PointSpriteClamp = 256.0;
+ this->PointSpriteSize = 0.15;
+ this->PointSpriteMinSize = 0.3;
+ this->PointSpriteMaxSize = 0.33;
+ this->PointSpriteMagnification = 1.0;
- this->PointSpriteAlphaThreshold = 0.1;
+ this->PointSpriteAlphaThreshold = 0.5;
this->PointSpriteTexture = 0;
this->UseOpenGLMapper = false;
VISU_OpenGLPointSpriteMapper* m = VISU_OpenGLPointSpriteMapper::SafeDownCast(mapper);
if( m != NULL )
{
+ this->SetPrimitiveType( m->GetPrimitiveType() );
+
this->SetPointSpriteMode( m->GetPointSpriteMode() );
- this->SetPointSpritePrimitiveType( m->GetPointSpritePrimitiveType() );
this->SetPointSpriteClamp( m->GetPointSpriteClamp() );
this->SetPointSpriteSize( m->GetPointSpriteSize() );
this->SetPointSpriteMinSize( m->GetPointSpriteMinSize() );
vglVertexAttrib1fARB( vglGetAttribLocationARB( this->VertexProgram, variable ), value );
}
//-----------------------------------------------------------------------------
-void VISU_OpenGLPointSpriteMapper::SetPointSpriteMode( int theMode )
+void VISU_OpenGLPointSpriteMapper::SetPrimitiveType( int thePrimitiveType )
{
- //cout << "SetPointSpriteMode " << this << " " << aMode << endl;
-
- this->PointSpriteMode = theMode;
- //this->SetShaderVariable( "mode", theMode );
+ this->PrimitiveType = thePrimitiveType;
this->Modified();
}
//-----------------------------------------------------------------------------
-void VISU_OpenGLPointSpriteMapper::SetPointSpritePrimitiveType( int thePrimitiveType )
+void VISU_OpenGLPointSpriteMapper::SetPointSpriteMode( int theMode )
{
- this->PointSpritePrimitiveType = thePrimitiveType;
+ this->PointSpriteMode = theMode;
this->Modified();
}
//-----------------------------------------------------------------------------
//
void VISU_OpenGLPointSpriteMapper::RenderPiece(vtkRenderer *ren, vtkActor *act)
{
- if( !this->ExtensionsInitialized && !this->UseOpenGLMapper )
+ bool isUseThisMapper = !( this->UseOpenGLMapper ||
+ this->PrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere );
+
+ if( !this->ExtensionsInitialized && isUseThisMapper )
{
this->InitExtensions();
act->GetProperty()->SetPointSize( 10.0f );
}
- if( this->UseOpenGLMapper )
+ if( !isUseThisMapper )
{
//cout << "Using OpenGLMapper" << endl;
MAPPER_SUPERCLASS::RenderPiece( ren, act );
ren->GetRenderWindow()->MakeCurrent();
// Initializing the texture for Point Sprites
- if( this->UseTextures && this->PointSpritePrimitiveType == 0 )
+ if( this->UseTextures && this->PrimitiveType == VISU_OpenGLPointSpriteMapper::PointSprite )
this->InitTextures();
//
else
size = this->PointSpriteSize;
- aVertex[i].hue = this->PointSpriteMagnification * size;
+ aVertex[i].hue = 1000.0 * this->AverageCellSize * this->PointSpriteMagnification * size;
}
GLuint aBufferObjectID = 0;
int VISU_OpenGLPointSpriteMapper::Draw(vtkRenderer *aren, vtkActor *act)
{
- if( this->UseOpenGLMapper )
+ if( this->UseOpenGLMapper || this->PrimitiveType == VISU_OpenGLPointSpriteMapper::GeomSphere )
return MAPPER_SUPERCLASS::Draw( aren, act );
vtkOpenGLRenderer *ren = (vtkOpenGLRenderer *)aren;
*/
enum RenderModes { Accumulate = 0, Occlude };
+ enum PrimitiveTypes { PointSprite = 0, OpenGLPoint, GeomSphere };
+
static VISU_OpenGLPointSpriteMapper *New();
vtkTypeRevisionMacro(VISU_OpenGLPointSpriteMapper,MAPPER_SUPERCLASS);
//! Get the initial point size to be used.
vtkGetMacro(DefaultPointSize, float);
+ //! Set Average Cell Size.
+ vtkSetMacro(AverageCellSize, float);
+
+ //! Get Average Cell Size.
+ vtkGetMacro(AverageCellSize, float);
+
//! Set the Render Mode for the mapper.
vtkSetMacro(RenderMode, int);
//! Get usage of vertex shader.
vtkGetMacro(UseShader, bool);
- // Description:
- // Point Sprite drawing mode
- // 0 - Results - different colors, different sizes
- // 1 - Geometry - fixed color, fixed size
- // 2 - Outside - different colors, fixed size
+ //! Point Sprite drawing mode
+ /*!
+ * 0 - Results - different colors, different sizes.
+ * 1 - Geometry - fixed color, fixed size.
+ * 2 - Outside - different colors, fixed size.
+ */
vtkGetMacro(PointSpriteMode, int);
void SetPointSpriteMode( int );
- // Description:
- // Point Sprite primitive type
- vtkGetMacro(PointSpritePrimitiveType, int);
- void SetPointSpritePrimitiveType( int );
+ //! Get the Primitive type
+ vtkGetMacro(PrimitiveType, int);
+
+ //! Set the Primitive type
+ void SetPrimitiveType( int );
//! Set Point Sprite Clamp.
void SetPointSpriteClamp( float );
GLhandleARB VertexProgram;
+ int PrimitiveType;
+
int PointSpriteMode;
- int PointSpritePrimitiveType;
float PointSpriteClamp;
float PointSpriteSize;
float PointSpriteMinSize;
GLuint PointSpriteTexture;
float PointSpriteAlphaThreshold;
+ float AverageCellSize;
+
vtkSmartPointer<vtkImageData> ImageData;
};
msgid "VisuGUI_Module::VISU_GAUSS_PREF_ALPHA_THRESHOLD"
msgstr "Alpha Channel Threshold"
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_RESOLUTION"
+msgstr "Resolution"
+
+msgid "VisuGUI_Module::VISU_GAUSS_PREF_FACE_LIMIT"
+msgstr "Notify when number of faces exceeds"
+
msgid "VisuGUI_Module::VISU_GAUSS_PREF_SIZE_GROUP_TTL"
msgstr "Size"
msgid "VVTK_PrimitiveBox::ALPHA_THRESHOLD"
msgstr "Alpha Channel Threshold : "
+msgid "VVTK_PrimitiveBox::RESOLUTION"
+msgstr "Resolution : "
+
+msgid "VVTK_PrimitiveBox::FACE_NUMBER"
+msgstr "Number of faces : "
+
+msgid "VVTK_PrimitiveBox::FACE_LIMIT"
+msgstr "Notify when number of faces exceeds : "
+
msgid "VVTK_SizeBox::SIZE_TITLE"
msgstr "Size"
myPrimitiveBox->setMainTexture( thePrs->GetMainTexture() );
myPrimitiveBox->setAlphaTexture( thePrs->GetAlphaTexture() );
myPrimitiveBox->setAlphaThreshold( thePrs->GetAlphaThreshold() );
+ myPrimitiveBox->setResolution( thePrs->GetResolution() );
+ myPrimitiveBox->setFaceLimit( 500 );
mySizeBox->setType( isResults || isDeformed ? VVTK_SizeBox::Results : VVTK_SizeBox::Geometry );
mySizeBox->setGeomSize( thePrs->GetGeomSize() );
thePrs->SetAlphaThreshold( myPrimitiveBox->getAlphaThreshold() );
+ thePrs->SetResolution( myPrimitiveBox->getResolution() );
+
bool isColored = !myGeometryButton->isChecked();
if( isColored )
{
float aClamp = aResourceMgr->doubleValue( "VISU", "point_sprite_clamp", GetClamp() );
SetClamp( aClamp );
- float aMinSize = aResourceMgr->doubleValue( "VISU", "point_sprite_min_size", GetMinSize() );
- SetMinSize( aMinSize );
+ int aMinSize = aResourceMgr->integerValue( "VISU", "point_sprite_min_size", ( int )( GetMinSize() * 100.0 ) );
+ SetMinSize( aMinSize / 100.0 );
- float aMaxSize = aResourceMgr->doubleValue( "VISU", "point_sprite_max_size", GetMaxSize() );
- SetMaxSize( aMaxSize );
+ int aMaxSize = aResourceMgr->integerValue( "VISU", "point_sprite_max_size", ( int )( GetMaxSize() * 100.0 ) );
+ SetMaxSize( aMaxSize / 100.0 );
- float aGeomSize = aResourceMgr->doubleValue( "VISU", "point_sprite_size", GetGeomSize() );
- SetGeomSize( aGeomSize );
+ int aGeomSize = aResourceMgr->integerValue( "VISU", "point_sprite_size", ( int )( GetGeomSize() * 100.0 ) );
+ SetGeomSize( aGeomSize / 100.0 );
- float aMagnification = aResourceMgr->doubleValue( "VISU", "point_sprite_magnification", GetMagnification() );
- SetMagnification( aMagnification );
+ int aMagnification = aResourceMgr->integerValue( "VISU", "point_sprite_magnification", ( int )( GetMagnification() * 100.0 ) );
+ SetMagnification( aMagnification / 100.0 );
float anIncrement = aResourceMgr->doubleValue( "VISU", "point_sprite_increment", GetMagnificationIncrement() );
SetMagnificationIncrement( anIncrement );
float anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "point_sprite_alpha_threshold", GetAlphaThreshold() );
SetAlphaThreshold( anAlphaThreshold );
+ int aResolution = aResourceMgr->integerValue( "VISU", "geom_sphere_resolution", GetResolution() );
+ SetResolution( aResolution );
+
QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp";
aMainTexture = aResourceMgr->stringValue( "VISU", "point_sprite_main_texture", aMainTexture );
SetTextures( Storable::FindValue(theMap,"myMainTexture"),
Storable::FindValue(theMap,"myAlphaTexture") );
+ SetResolution(Storable::FindValue(theMap,"myResolution").toInt());
+
return this;
}
Storable::DataToStream( theStr, "myAlphaThreshold", GetAlphaThreshold() );
Storable::DataToStream( theStr, "myMainTexture", GetMainTexture() );
Storable::DataToStream( theStr, "myAlphaTexture", GetAlphaTexture() );
+
+ Storable::DataToStream( theStr, "myResolution", GetResolution() );
}
return myGaussPointsPL->GetAlphaThreshold();
}
+void
+VISU::GaussPoints_i
+::SetResolution( int theResolution )
+{
+ myGaussPointsPL->SetResolution( theResolution );
+}
+
+int
+VISU::GaussPoints_i
+::GetResolution()
+{
+ return myGaussPointsPL->GetResolution();
+}
+
void
VISU::GaussPoints_i
::SetPrimitiveType(int thePrimitiveType)
try{
TSuperClass::CreateActor(theActor,theIO);
theActor->GetPipeLine()->Delete();
- theActor->SetRepresentation(VTK_POINTS);
UpdateActor(theActor);
return true;
}catch(...){
myColor.green() / 255.0,
myColor.blue() / 255.0);
}
+
+ if( GetGaussPointsPL()->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere )
+ theActor->SetRepresentation( VTK_POINTS );
+ else
+ theActor->SetRepresentation( VTK_SURFACE );
}
TSuperClass::UpdateActor(theActor);
}
float
GetAlphaThreshold();
+ //! Redirect the request to VISU_GaussPointsPL::SetResolution.
+ void
+ SetResolution(int theResolution);
+
+ //! Redirect the request to VISU_GaussPointsPL::GetResolution.
+ int
+ GetResolution();
+
void
SetPrimitiveType(int thePrimitiveType);
#include "VVTK_PrimitiveBox.h"
+#include "VISU_OpenGLPointSpriteMapper.hxx"
+
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
#include "QtxDblSpinBox.h"
+#include "QtxIntSpinBox.h"
#include <qlayout.h>
#include <qlabel.h>
aLayout->setSpacing(6);
aLayout->setMargin(11);
- myPrimitiveType = VVTK_PrimitiveBox::PointSprite;
+ myPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite;
QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/";
myMainTexture = aRootDir + "sprite_texture.bmp";
aLayout->addMultiCellWidget( aPrimitiveTypeGroup, 0, 0, 0, 2 );
- // Clamp
+ // Clamp ( Point Sprite & OpenGL Point )
myClampLabel = new QLabel( tr( "CLAMP" ), this );
myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, this );
myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
aLayout->addWidget( myClampLabel, 1, 0 );
aLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 );
- // Main Texture
+ // Main Texture ( Point Sprite )
myMainTextureLabel = new QLabel( tr( "MAIN_TEXTURE" ), this );
myMainTextureLineEdit = new QLineEdit( this );
myMainTextureButton = new QPushButton( this );
aLayout->addWidget( myMainTextureLineEdit, 2, 1 );
aLayout->addWidget( myMainTextureButton, 2, 2 );
- // Alpha Texture
+ // Alpha Texture ( Point Sprite )
myAlphaTextureLabel = new QLabel( tr( "ALPHA_TEXTURE" ), this );
myAlphaTextureLineEdit = new QLineEdit( this );
myAlphaTextureButton = new QPushButton( this );
aLayout->addWidget( myAlphaTextureLineEdit, 3, 1 );
aLayout->addWidget( myAlphaTextureButton, 3, 2 );
- // Alpha Threshold
+ // Alpha Threshold ( Point Sprite )
myAlphaThresholdLabel = new QLabel( tr( "ALPHA_THRESHOLD" ), this );
myAlphaThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, this );
myAlphaThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
aLayout->addWidget( myAlphaThresholdLabel, 4, 0 );
aLayout->addMultiCellWidget( myAlphaThresholdSpinBox, 4, 4, 1, 2 );
+ // Resolution ( Geometrical Sphere )
+ myResolutionLabel = new QLabel( tr( "RESOLUTION" ), this );
+ myResolutionSpinBox = new QtxIntSpinBox( 3, 100, 1, this );
+ myResolutionSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ connect( myResolutionSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( onResolutionChanged( int ) ) );
+
+ aLayout->addWidget( myResolutionLabel, 1, 0 );
+ aLayout->addMultiCellWidget( myResolutionSpinBox, 1, 1, 1, 2 );
+
+ // Number of faces ( Geometrical Sphere )
+ myFaceNumberLabel = new QLabel( tr( "FACE_NUMBER" ), this );
+ myFaceNumberLineEdit = new QLineEdit( this );
+ myFaceNumberLineEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ myFaceNumberLineEdit->setReadOnly( true );
+
+ aLayout->addWidget( myFaceNumberLabel, 2, 0 );
+ aLayout->addMultiCellWidget( myFaceNumberLineEdit, 2, 2, 1, 2 );
+
+ // Notification ( Geometrical Sphere )
+ myFaceLimitLabel = new QLabel( tr( "FACE_LIMIT" ), this );
+ myFaceLimitSpinBox = new QtxIntSpinBox( 10, 10000, 10, this );
+ myFaceLimitSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ aLayout->addWidget( myFaceLimitLabel, 3, 0 );
+ aLayout->addMultiCellWidget( myFaceLimitSpinBox, 3, 3, 1, 2 );
+
connect( myPointSpriteButton, SIGNAL( clicked() ), this, SLOT( onTogglePointSprite() ) );
connect( myOpenGLPointButton, SIGNAL( clicked() ), this, SLOT( onToggleOpenGLPoint() ) );
connect( myGeomSphereButton, SIGNAL( clicked() ), this, SLOT( onToggleGeomSphere() ) );
void VVTK_PrimitiveBox::onTogglePointSprite()
{
- myPrimitiveType = VVTK_PrimitiveBox::PointSprite;
+ myPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite;
myClampLabel->show();
myClampSpinBox->show();
myAlphaThresholdLabel->show();
myAlphaThresholdSpinBox->show();
+
+ myResolutionLabel->hide();
+ myResolutionSpinBox->hide();
+
+ myFaceNumberLabel->hide();
+ myFaceNumberLineEdit->hide();
+
+ myFaceLimitLabel->hide();
+ myFaceLimitSpinBox->hide();
}
void VVTK_PrimitiveBox::onToggleOpenGLPoint()
{
- myPrimitiveType = VVTK_PrimitiveBox::OpenGLPoint;
+ myPrimitiveType = VISU_OpenGLPointSpriteMapper::OpenGLPoint;
myClampLabel->show();
myClampSpinBox->show();
myAlphaThresholdLabel->hide();
myAlphaThresholdSpinBox->hide();
+
+ myResolutionLabel->hide();
+ myResolutionSpinBox->hide();
+
+ myFaceNumberLabel->hide();
+ myFaceNumberLineEdit->hide();
+
+ myFaceLimitLabel->hide();
+ myFaceLimitSpinBox->hide();
}
void VVTK_PrimitiveBox::onToggleGeomSphere()
{
- myPrimitiveType = VVTK_PrimitiveBox::GeomSphere;
+ myPrimitiveType = VISU_OpenGLPointSpriteMapper::GeomSphere;
myClampLabel->hide();
myClampSpinBox->hide();
myAlphaThresholdLabel->hide();
myAlphaThresholdSpinBox->hide();
+
+ myResolutionLabel->show();
+ myResolutionSpinBox->show();
+
+ myFaceNumberLabel->show();
+ myFaceNumberLineEdit->show();
+
+ myFaceLimitLabel->show();
+ myFaceLimitSpinBox->show();
+}
+
+void VVTK_PrimitiveBox::onResolutionChanged( int theResolution )
+{
+ setFaceNumber( 2 * theResolution * ( theResolution - 2 ) );
}
void VVTK_PrimitiveBox::setPrimitiveType( int theType )
switch( myPrimitiveType )
{
- case VVTK_PrimitiveBox::PointSprite :
+ case VISU_OpenGLPointSpriteMapper::PointSprite :
myPointSpriteButton->setChecked( true );
onTogglePointSprite();
break;
- case VVTK_PrimitiveBox::OpenGLPoint :
+ case VISU_OpenGLPointSpriteMapper::OpenGLPoint :
myOpenGLPointButton->setChecked( true );
onToggleOpenGLPoint();
break;
- case VVTK_PrimitiveBox::GeomSphere :
+ case VISU_OpenGLPointSpriteMapper::GeomSphere :
myGeomSphereButton->setChecked( true );
onToggleGeomSphere();
break;
myAlphaThresholdSpinBox->setValue( theAlphaThreshold );
}
+int VVTK_PrimitiveBox::getResolution() const
+{
+ return myResolutionSpinBox->value();
+}
+
+void VVTK_PrimitiveBox::setResolution( int theResolution )
+{
+ myResolutionSpinBox->setValue( theResolution );
+}
+
+int VVTK_PrimitiveBox::getFaceNumber() const
+{
+ return myFaceNumberLineEdit->text().toInt();
+}
+
+void VVTK_PrimitiveBox::setFaceNumber( int theFaceNumber )
+{
+ myFaceNumberLineEdit->setText( QString::number( theFaceNumber ) );
+}
+
+int VVTK_PrimitiveBox::getFaceLimit() const
+{
+ return myFaceLimitSpinBox->value();
+}
+
+void VVTK_PrimitiveBox::setFaceLimit( int theFaceLimit )
+{
+ myFaceLimitSpinBox->setValue( theFaceLimit );
+}
+
void VVTK_PrimitiveBox::onBrowseMainTexture()
{
QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/";
class QRadioButton;
class QtxDblSpinBox;
+class QtxIntSpinBox;
class VVTK_PrimitiveBox : public QGroupBox
{
Q_OBJECT
-public:
- enum { PointSprite = 0, OpenGLPoint, GeomSphere };
-
public:
VVTK_PrimitiveBox( QWidget* );
~VVTK_PrimitiveBox() {}
float getAlphaThreshold() const;
void setAlphaThreshold( float );
+ int getResolution() const;
+ void setResolution( int );
+
+ int getFaceNumber() const;
+ void setFaceNumber( int );
+
+ int getFaceLimit() const;
+ void setFaceLimit( int );
+
protected slots:
void onTogglePointSprite();
void onToggleOpenGLPoint();
void onBrowseMainTexture();
void onBrowseAlphaTexture();
+ void onResolutionChanged( int );
+
private:
int myPrimitiveType;
QLabel* myAlphaThresholdLabel;
QtxDblSpinBox* myAlphaThresholdSpinBox;
+
+ QLabel* myResolutionLabel;
+ QtxIntSpinBox* myResolutionSpinBox;
+
+ QLabel* myFaceNumberLabel;
+ QLineEdit* myFaceNumberLineEdit;
+
+ QLabel* myFaceLimitLabel;
+ QtxIntSpinBox* myFaceLimitSpinBox;
};
void VVTK_SegmentationCursorDlg::UpdateInsideGaussPoints()
{
- int aPrimitiveType = VVTK_PrimitiveBox::PointSprite;
+ int aPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite;
float aClamp = 200.0;
QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp";
QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp";
float anAlphaThreshold = 0.1;
int aMinSize = 3;
int aMaxSize = 33;
- float aMagnification = 100.0;
+ int aMagnification = 100;
float anIncrement = 2.0;
if( !myInsideCursorSettings->GetInitial() )
myInsidePrimitiveBox->setAlphaThreshold( anAlphaThreshold );
aMinSize = aResourceMgr->integerValue( "VISU", "inside_point_sprite_min_size", aMinSize );
- myInsideSizeBox->setMinSize( aMinSize );
+ myInsideSizeBox->setMinSize( aMinSize / 100.0 );
aMaxSize = aResourceMgr->integerValue( "VISU", "inside_point_sprite_max_size", aMaxSize );
- myInsideSizeBox->setMaxSize( aMaxSize );
+ myInsideSizeBox->setMaxSize( aMaxSize / 100.0 );
- aMagnification = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_magnification", aMagnification );
- myInsideSizeBox->setMagnification( aMagnification );
+ aMagnification = aResourceMgr->integerValue( "VISU", "inside_point_sprite_magnification", aMagnification );
+ myInsideSizeBox->setMagnification( aMagnification / 100.0 );
anIncrement = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_increment", anIncrement );
myInsideSizeBox->setIncrement( anIncrement );
void VVTK_SegmentationCursorDlg::UpdateOutsideGaussPoints()
{
float aClamp = 256.0;
- int aPrimitiveType = VVTK_PrimitiveBox::PointSprite;
+ int aPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite;
QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp";
QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp";
float anAlphaThreshold = 0.1;
myOutsidePrimitiveBox->setAlphaThreshold( anAlphaThreshold );
aSize = aResourceMgr->integerValue( "VISU", "outside_point_sprite_size", aSize );
- myOutsideSizeBox->setOutsideSize( aSize );
+ myOutsideSizeBox->setOutsideSize( aSize / 100.0 );
aUniform = aResourceMgr->booleanValue( "VISU", "outside_point_sprite_uniform", aUniform );
myOutsideSizeBox->setUniform( aUniform );
#include "SUIT_Session.h"
#include "QtxDblSpinBox.h"
+#include "QtxIntSpinBox.h"
#include <qlayout.h>
#include <qlabel.h>
// Outside Size
myOutsideSizeLabel = new QLabel( tr( "OUTSIDE_SIZE" ), SizeGroup );
- myOutsideSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup );
+ myOutsideSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup );
myOutsideSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SizeGroupLayout->addWidget( myOutsideSizeLabel, 0, 0 );
// Geometry Size
myGeomSizeLabel = new QLabel( tr( "GEOM_SIZE" ), SizeGroup );
- myGeomSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup );
+ myGeomSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup );
myGeomSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SizeGroupLayout->addWidget( myGeomSizeLabel, 0, 0 );
// Min Size
myMinSizeLabel = new QLabel( tr( "MIN_SIZE" ), SizeGroup );
- myMinSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup );
+ myMinSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup );
myMinSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SizeGroupLayout->addWidget( myMinSizeLabel, 1, 0 );
// Max Size
myMaxSizeLabel = new QLabel( tr( "MAX_SIZE" ), SizeGroup );
- myMaxSizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup );
+ myMaxSizeSpinBox = new QtxIntSpinBox( 0, 100, 1, SizeGroup );
myMaxSizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SizeGroupLayout->addWidget( myMaxSizeLabel, 1, 2 );
// Magnification
myMagnificationLabel = new QLabel( tr( "MAGNIFICATION" ), SizeGroup );
- myMagnificationSpinBox = new QtxDblSpinBox( 10, 1000, 10, SizeGroup );
+ myMagnificationSpinBox = new QtxIntSpinBox( 10, 1000, 10, SizeGroup );
myMagnificationSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SizeGroupLayout->addWidget( myMagnificationLabel, 2, 0 );
float VVTK_SizeBox::getOutsideSize() const
{
- return myOutsideSizeSpinBox->value();
+ return myOutsideSizeSpinBox->value() / 100.0;
}
void VVTK_SizeBox::setOutsideSize( float theOutsideSize )
{
- myOutsideSizeSpinBox->setValue( theOutsideSize );
+ myOutsideSizeSpinBox->setValue( theOutsideSize * 100.0 );
}
float VVTK_SizeBox::getGeomSize() const
{
- return myGeomSizeSpinBox->value();
+ return myGeomSizeSpinBox->value() / 100.0;
}
void VVTK_SizeBox::setGeomSize( float theGeomSize )
{
- myGeomSizeSpinBox->setValue( theGeomSize );
+ myGeomSizeSpinBox->setValue( theGeomSize * 100.0 );
}
float VVTK_SizeBox::getMinSize() const
{
- return myMinSizeSpinBox->value();
+ return myMinSizeSpinBox->value() / 100.0;
}
void VVTK_SizeBox::setMinSize( float theMinSize )
{
- myMinSizeSpinBox->setValue( theMinSize );
+ myMinSizeSpinBox->setValue( theMinSize * 100.0 );
}
float VVTK_SizeBox::getMaxSize() const
{
- return myMaxSizeSpinBox->value();
+ return myMaxSizeSpinBox->value() / 100.0;
}
void VVTK_SizeBox::setMaxSize( float theMaxSize )
{
- myMaxSizeSpinBox->setValue( theMaxSize );
+ myMaxSizeSpinBox->setValue( theMaxSize * 100.0 );
}
float VVTK_SizeBox::getMagnification() const
{
- return myMagnificationSpinBox->value();
+ return myMagnificationSpinBox->value() / 100.0;
}
void VVTK_SizeBox::setMagnification( float theMagnification )
{
- myMagnificationSpinBox->setValue( theMagnification );
+ myMagnificationSpinBox->setValue( theMagnification * 100.0 );
}
float VVTK_SizeBox::getIncrement() const
class QGroupBox;
class QtxDblSpinBox;
+class QtxIntSpinBox;
class VVTK_SizeBox : public QVBox
{
int myType;
QLabel* myOutsideSizeLabel;
- QtxDblSpinBox* myOutsideSizeSpinBox;
+ QtxIntSpinBox* myOutsideSizeSpinBox;
QLabel* myGeomSizeLabel;
- QtxDblSpinBox* myGeomSizeSpinBox;
+ QtxIntSpinBox* myGeomSizeSpinBox;
QLabel* myMinSizeLabel;
- QtxDblSpinBox* myMinSizeSpinBox;
+ QtxIntSpinBox* myMinSizeSpinBox;
QLabel* myMaxSizeLabel;
- QtxDblSpinBox* myMaxSizeSpinBox;
+ QtxIntSpinBox* myMaxSizeSpinBox;
QLabel* myMagnificationLabel;
- QtxDblSpinBox* myMagnificationSpinBox;
+ QtxIntSpinBox* myMagnificationSpinBox;
QLabel* myIncrementLabel;
QtxDblSpinBox* myIncrementSpinBox;