vtkDataSet* aDataSet = GetInput();
vtkCellData* aCellData = aDataSet->GetCellData();
if(vtkDataArray *aScalarArray = aCellData->GetScalars()){
- float aRadius = myGaussPointsPL->GetPointSize(aVtkId,aScalarArray);
+ float aRadius = myGaussPointsPL->GetPointSize(aVtkId,aScalarArray) / 2.;
float aPyramidHeight = myPickingSettings->GetPyramidHeight();
aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
//float aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
//
if(vtkDataArray* aScalarArray = aDataSetAttributes->GetScalars()){
aVal = aScalarArray->GetTuple1(aVtkId);
- aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray);
+ aRadius = myGaussPointsPL->GetPointSize(aVtkId, aScalarArray) / 2.;
//
GetScalarBarCtrl()->SetIsMarked(true);
GetScalarBarCtrl()->SetMarkValue(aVal);
aPipeline->SetClamp( myInsideCursorSettings->GetClamp() );
aPipeline->SetImageData( myInsideCursorSettings->GetTexture() );
aPipeline->SetAlphaThreshold( myInsideCursorSettings->GetAlphaThreshold() );
+ aPipeline->SetResolution( myInsideCursorSettings->GetResolution() );
aPipeline->SetMinSize( myInsideCursorSettings->GetMinSize() );
aPipeline->SetMaxSize( myInsideCursorSettings->GetMaxSize() );
aPipeline->SetMagnification( myInsideCursorSettings->GetMagnification() );
aPipeline->SetMagnificationIncrement( myInsideCursorSettings->GetIncrement() );
+ if( myInsideCursorSettings->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere )
+ theActor->GetProperty()->SetRepresentation( VTK_POINTS );
+ else
+ theActor->GetProperty()->SetRepresentation( VTK_SURFACE );
+
+ //aPipeLine->Update();
+
Update();
}
myEventCallbackCommand->SetCallback(VISU_GaussPtsAct1::ProcessEvents);
- myInsideDeviceActor->SetProperty(GetProperty());
myInsideDeviceActor->SetVisibility(false);
myInsideDeviceActor->SetPickable(false);
myInsideDeviceActor->Delete();
anExtractGeometry->SetExtractInside(true);
aPipeline->SetPrimitiveType( myOutsideCursorSettings->GetPrimitiveType() );
+
+ if( myOutsideCursorSettings->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere )
+ myOutsideDeviceActor->GetProperty()->SetRepresentation( VTK_POINTS );
+ else
+ myOutsideDeviceActor->GetProperty()->SetRepresentation( VTK_SURFACE );
+
aPipeline->SetClamp( myOutsideCursorSettings->GetClamp() );
aPipeline->SetImageData( myOutsideCursorSettings->GetTexture() );
aPipeline->SetAlphaThreshold( myOutsideCursorSettings->GetAlphaThreshold() );
+ aPipeline->SetResolution( myOutsideCursorSettings->GetResolution() );
aPipeline->SetSize( myOutsideCursorSettings->GetSize() );
if( myOutsideCursorSettings->GetUniform() )
myOutsideDeviceActor->GetPSMapper()->ScalarVisibilityOn();
}
+ aPipeline->Update();
+
Update();
}
}
+//----------------------------------------------------------------------------
+void
+CopyGlyph( vtkGlyph3D* source, vtkGlyph3D* dest )
+{
+ dest->SetRange( source->GetRange() );
+ dest->SetScaling( source->GetScaling() );
+ dest->SetClamping( source->GetClamping() );
+ dest->SetScaleMode( source->GetScaleMode() );
+ dest->SetColorMode( source->GetColorMode() );
+ dest->SetScaleFactor( source->GetScaleFactor() );
+}
+
+
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
SetIsDeformed( aPipeLine->GetIsDeformed() );
SetScale( aPipeLine->GetScale() );
+
+ mySphereSource->SetRadius( aPipeLine->mySphereSource->GetRadius() );
+ CopyGlyph( aPipeLine->myGlyph, this->myGlyph );
}
Superclass::ShallowCopy(thePipeLine);
}
void
VISU_GaussPointsPL
::Build()
-{}
+{
+}
//----------------------------------------------------------------------------
void
VISU_GaussPointsPL
::Update()
{
+ //cout << "VISU_GaussPointsPL::Update()" << endl;
+
GetSourceRange(mySourceScalarRange);
myDeltaScalarRange = mySourceScalarRange[1] - mySourceScalarRange[0];
SetAverageCellSize( VISU_DeformedShapePL::GetScaleFactor( GetParentMesh() ) );
- mySphereSource->SetRadius( GetMagnification() * GetAverageCellSize() / 2. );
-
vtkMapper* aMapper = GetMapper();
vtkDataSet* aDataSet = aMapper->GetInput();
vtkCellData* aCellData = aDataSet->GetCellData();
myPSMapper->SetLookupTable( myMapperTable );
myPSMapper->SetScalarRange( mySourceScalarRange );
+ this->UpdateGlyph();
+
VISU_ScalarMapPL::Update();
}
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::UpdateGlyph()
+{
+ //cout << "VISU_GaussPointsPL::UpdateGlyph()" << endl;
+
+ float aScalarRange[2];
+ GetSourceRange( aScalarRange );
+
+ if( myPSMapper->GetPointSpriteMode() == 0 ) // Results
+ {
+ //cout << "Results" << endl;
+ myGlyph->ClampingOn();
+ myGlyph->SetScaleModeToScaleByScalar();
+ myGlyph->SetColorModeToColorByScalar();
+
+ float aRange = 0;
+ float aMinSize = GetMinSize();
+ float aMaxSize = GetMaxSize();
+ if( fabs( aMaxSize - aMinSize ) > 0.0001 )
+ aRange = ( aScalarRange[1] - aScalarRange[0] ) / ( aMaxSize - aMinSize );
+ float aMinRange = aScalarRange[0] - aMinSize * aRange;
+ float aMaxRange = aMinRange + aRange;
+
+ myGlyph->SetRange( aMinRange, aMaxRange );
+ myGlyph->SetScaleFactor( 1.0 );
+ }
+ else if( myPSMapper->GetPointSpriteMode() == 1 ) // Geometry
+ {
+ //cout << "Geometry" << endl;
+ myGlyph->ClampingOff();
+ myGlyph->SetScaleModeToDataScalingOff();
+ myGlyph->SetColorModeToColorByScale();
+
+ myGlyph->SetScaleFactor( GetSize() );
+ }
+ else if( myPSMapper->GetPointSpriteMode() == 2 ) // Outside
+ {
+ //cout << "Outside" << endl;
+ myGlyph->ClampingOff();
+ myGlyph->SetScaleModeToDataScalingOff();
+ myGlyph->SetColorModeToColorByScalar();
+
+ myGlyph->SetScaleFactor( GetSize() );
+ }
+
+ mySphereSource->SetRadius( GetMagnification() * GetAverageCellSize() / 2. );
+}
+
//----------------------------------------------------------------------------
VISU::TGaussPointID
VISU_GaussPointsPL
::SetIsColored(bool theIsColored)
{
myPSMapper->SetPointSpriteMode( theIsColored ? 0 : 1 ); // Results / Geometry
+ Modified();
}
//----------------------------------------------------------------------------
return myPSMapper->GetPointSpriteSize();
}
-//----------------------------------------------------------------------------
-void
-VISU_GaussPointsPL
-::UpdateGlyphRange()
-{
- 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();
}
::SetMaxSize(float theMaxSize)
{
myPSMapper->SetPointSpriteMaxSize( theMaxSize );
- UpdateGlyphRange();
Modified();
}
void
Update();
+ //! Update glyph.
+ void
+ UpdateGlyph();
+
virtual
VISU::TGaussPointID
GetObjID(vtkIdType theID) const;
float
GetAverageCellSize();
- //! Update scalar range of the glyph.
- void
- UpdateGlyphRange();
-
//! Set image data for the Point Sprite texture.
void
SetImageData(vtkImageData* theImageData);
GLfloat vx, vy, vz;
};
+float ViewToDisplay( vtkRenderer* theRenderer )
+{
+ float p1[3], p2[3];
+
+ theRenderer->SetViewPoint( 0.0, 0.0, 0.0 );
+ theRenderer->ViewToDisplay();
+ theRenderer->GetDisplayPoint( p1 );
+
+ theRenderer->SetViewPoint( 1.0, 1.0, 1.0 );
+ theRenderer->ViewToDisplay();
+ theRenderer->GetDisplayPoint( p2 );
+
+ float coefficient = sqrt( pow( p2[0] - p1[0], 2 ) + pow( p2[1] - p1[1], 2 ) ) / sqrt( 2 );
+ //cout << p1[0] << " " << p1[1] << " " << p1[2] << endl;
+ //cout << p2[0] << " " << p2[1] << " " << p2[2] << endl;
+ //cout << "ZOOM : " << coefficient << endl;
+
+ return coefficient;
+}
+
//-----------------------------------------------------------------------------
void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *p,
vtkUnsignedCharArray *colors,
vtkRenderer *ren,
vtkActor* act)
{
- if( this->UsePointSprites )
+ if( this->UsePointSprites ) //&& this->PrimitiveType == VISU_OpenGLPointSpriteMapper::PointSprite )
this->InitPointSprites();
- float p1[3], p2[3];
-
- ren->SetViewPoint( 0.0, 0.0, 0.0 );
- ren->ViewToDisplay();
- ren->GetDisplayPoint( p1 );
-
- ren->SetViewPoint( 1.0, 1.0, 1.0 );
- ren->ViewToDisplay();
- ren->GetDisplayPoint( p2 );
-
- float coefficient = sqrt( pow( p2[0] - p1[0], 2 ) + pow( p2[1] - p1[1], 2 ) ) / sqrt( 2 );
- //cout << p1[0] << " " << p1[1] << " " << p1[2] << endl;
- //cout << p2[0] << " " << p2[1] << " " << p2[2] << endl;
- //cout << "ZOOM : " << coefficient << endl;
+ if( this->PrimitiveType == VISU_OpenGLPointSpriteMapper::OpenGLPoint )
+ glEnable( GL_POINT_SMOOTH );
glPointSize( this->DefaultPointSize );
else
size = this->PointSpriteSize;
- aVertex[i].hue = coefficient * this->AverageCellSize * this->PointSpriteMagnification * size;
+ aVertex[i].hue = ViewToDisplay( ren ) * this->AverageCellSize * this->PointSpriteMagnification * size;
}
GLuint aBufferObjectID = 0;
vglUseProgramObjectARB( 0 );
- if( this->UsePointSprites )
+ if( this->UsePointSprites ) //&& this->PrimitiveType == VISU_OpenGLPointSpriteMapper::PointSprite )
this->CleanupPointSprites();
+
+ if( this->PrimitiveType == VISU_OpenGLPointSpriteMapper::OpenGLPoint )
+ glDisable( GL_POINT_SMOOTH );
}
//-----------------------------------------------------------------------------
bool isDeformed = thePrs->GetIsDeformed();
myScaleSpinBox->setValue( thePrs->GetScaleFactor() );
myDefShapeButton->setChecked( isDeformed );
+ myDefShapeButton->setEnabled( thePrs->GetField()->myNbComp > 1 );
onToggleDefShape( isDeformed );
bool isResults = thePrs->GetIsColored();
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 aResolution = 8;
int aMinSize = 3;
int aMaxSize = 33;
int aMagnification = 100;
myInsidePrimitiveBox->setMainTexture( myInsideMainTexture );
myInsidePrimitiveBox->setAlphaTexture( myInsideAlphaTexture );
myInsidePrimitiveBox->setAlphaThreshold( myInsideCursorSettings->GetAlphaThreshold() );
+ myInsidePrimitiveBox->setResolution( myInsideCursorSettings->GetResolution() );
myInsideSizeBox->setMinSize( myInsideCursorSettings->GetMinSize() );
myInsideSizeBox->setMaxSize( myInsideCursorSettings->GetMaxSize() );
anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "inside_point_sprite_alpha_threshold", anAlphaThreshold );
myInsidePrimitiveBox->setAlphaThreshold( anAlphaThreshold );
+ aResolution = aResourceMgr->integerValue( "VISU", "inside_geom_sphere_resolution", aResolution );
+ myInsidePrimitiveBox->setResolution( aResolution );
+
aMinSize = aResourceMgr->integerValue( "VISU", "inside_point_sprite_min_size", aMinSize );
myInsideSizeBox->setMinSize( aMinSize / 100.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 aResolution = 8;
int aSize = 25;
bool aUniform = false;
QColor aColor = Qt::blue;
myOutsidePrimitiveBox->setMainTexture( myOutsideMainTexture );
myOutsidePrimitiveBox->setAlphaTexture( myOutsideAlphaTexture );
myOutsidePrimitiveBox->setAlphaThreshold( myOutsideCursorSettings->GetAlphaThreshold() );
+ myOutsidePrimitiveBox->setResolution( myOutsideCursorSettings->GetResolution() );
myOutsideSizeBox->setOutsideSize( myOutsideCursorSettings->GetSize() );
myOutsideSizeBox->setUniform( myOutsideCursorSettings->GetUniform() );
anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "outside_point_sprite_alpha_threshold", anAlphaThreshold );
myOutsidePrimitiveBox->setAlphaThreshold( anAlphaThreshold );
+ aResolution = aResourceMgr->integerValue( "VISU", "outside_geom_sphere_resolution", aResolution );
+ myOutsidePrimitiveBox->setResolution( aResolution );
+
aSize = aResourceMgr->integerValue( "VISU", "outside_point_sprite_size", aSize );
myOutsideSizeBox->setOutsideSize( aSize / 100.0 );
myInsideCursorSettings->SetPrimitiveType( myInsidePrimitiveBox->getPrimitiveType() );
myInsideCursorSettings->SetClamp( myInsidePrimitiveBox->getClamp() );
myInsideCursorSettings->SetAlphaThreshold( myInsidePrimitiveBox->getAlphaThreshold() );
+ myInsideCursorSettings->SetResolution( myInsidePrimitiveBox->getResolution() );
myInsideCursorSettings->SetMinSize( myInsideSizeBox->getMinSize() );
myInsideCursorSettings->SetMaxSize( myInsideSizeBox->getMaxSize() );
myOutsideCursorSettings->SetPrimitiveType( myOutsidePrimitiveBox->getPrimitiveType() );
myOutsideCursorSettings->SetClamp( myOutsidePrimitiveBox->getClamp() );
myOutsideCursorSettings->SetAlphaThreshold( myOutsidePrimitiveBox->getAlphaThreshold() );
+ myOutsideCursorSettings->SetResolution( myOutsidePrimitiveBox->getResolution() );
myOutsideCursorSettings->SetSize( myOutsideSizeBox->getOutsideSize() );
myOutsideCursorSettings->SetUniform( myOutsideSizeBox->getUniform() );