]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
alpha threshold added
authorouv <ouv@opencascade.com>
Fri, 30 Sep 2005 12:17:13 +0000 (12:17 +0000)
committerouv <ouv@opencascade.com>
Fri, 30 Sep 2005 12:17:13 +0000 (12:17 +0000)
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_GaussPointsPL.hxx

index fd1275df08a9c1cd2742baf62816d81d8540713d..060659ac9c290a2d7ac0034e80b11a6d468e2116 100644 (file)
@@ -44,10 +44,13 @@ vtkStandardNewMacro(VISU_GaussPointsPL);
 //----------------------------------------------------------------------------
 VISU_GaussPointsPL
 ::VISU_GaussPointsPL():
-  myRelativeSize(0.1),
-  myRelativeMinSize(0.03),
-  myRelativeMaxSize(0.30),
-  myMagnificationIncrement(0.1)
+  myClamp(200.0),
+  mySize(10),
+  myMinSize(3),
+  myMaxSize(33),
+  myMagnification(100),
+  myMagnificationIncrement(10),
+  myAlphaThreshold(0.1)
 {
   myPSMapper = VISU_OpenGLPointSpriteMapper::New();
   //myPSMapper->DebugOn();
@@ -70,11 +73,12 @@ VISU_GaussPointsPL
 
     SetGaussPtsIDMapper(aPipeLine->GetGaussPtsIDMapper());
     SetClamp(aPipeLine->GetClamp());
-    SetRelativeSize(aPipeLine->GetRelativeSize());
-    SetRelativeMinSize(aPipeLine->GetRelativeMinSize());
-    SetRelativeMaxSize(aPipeLine->GetRelativeMaxSize());
+    SetSize(aPipeLine->GetSize());
+    SetMinSize(aPipeLine->GetMinSize());
+    SetMaxSize(aPipeLine->GetMaxSize());
     SetMagnification(aPipeLine->GetMagnification());
     SetMagnificationIncrement(aPipeLine->GetMagnificationIncrement());
+    SetAlphaThreshold(aPipeLine->GetAlphaThreshold());
     Init();
   }
 }
@@ -207,40 +211,32 @@ VISU_GaussPointsPL
   return myMapperTable->GetBicolor();
 }
 
-//----------------------------------------------------------------------------
-void
-VISU_GaussPointsPL
-::SetClamp(float theClamp)
-{
-  myPSMapper->SetPointSpriteClamp( theClamp );
-
-  Modified();
-}
-
 //----------------------------------------------------------------------------
 float
 VISU_GaussPointsPL
-::GetClamp()
+::GetMaximumSupportedSize()
 {
-  return 200.0;
+  return myPSMapper->GetMaximumSupportedSize();
 }
 
 //----------------------------------------------------------------------------
-float
+void
 VISU_GaussPointsPL
-::GetMaximumSupportedSize()
+::SetClamp(float theClamp)
 {
-  return myPSMapper->GetMaximumSupportedSize();
+  myClamp = theClamp;
+  myPSMapper->SetPointSpriteClamp( theClamp );
+
+  Modified();
 }
 
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
-::SetRelativeSize(float theRelativeSize)
+::SetSize(float theSize)
 {
-  myRelativeSize = theRelativeSize;
-
-  myPSMapper->SetPointSpriteSize( 1000.0 * myAverageCellSize * myRelativeSize );
+  mySize = theSize;
+  myPSMapper->SetPointSpriteSize( 1000.0 * myAverageCellSize * mySize / 100.0 );
 
   Modified();
 }
@@ -248,11 +244,11 @@ VISU_GaussPointsPL
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
-::SetRelativeMinSize(float theRelativeMinSize)
+::SetMinSize(float theMinSize)
 {
-  myRelativeMinSize = theRelativeMinSize;
+  myMinSize = theMinSize;
   myPSMapper->SetPointSpriteSize( 0.0 );
-  myPSMapper->SetPointSpriteMinSize( 1000.0 * myAverageCellSize * myRelativeMinSize );
+  myPSMapper->SetPointSpriteMinSize( 1000.0 * myAverageCellSize * myMinSize / 100.0 );
 
   Modified();
 }
@@ -260,11 +256,11 @@ VISU_GaussPointsPL
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
-::SetRelativeMaxSize(float theRelativeMaxSize)
+::SetMaxSize(float theMaxSize)
 {
-  myRelativeMaxSize = theRelativeMaxSize;
+  myMaxSize = theMaxSize;
   myPSMapper->SetPointSpriteSize( 0.0 );
-  myPSMapper->SetPointSpriteMaxSize( 1000.0 * myAverageCellSize * myRelativeMaxSize );
+  myPSMapper->SetPointSpriteMaxSize( 1000.0 * myAverageCellSize * myMaxSize / 100.0 );
 
   Modified();
 }
@@ -274,18 +270,12 @@ void
 VISU_GaussPointsPL
 ::SetMagnification(float theMagnification)
 {
-  myPSMapper->SetPointSpriteMagnification( theMagnification );
+  myMagnification = theMagnification;
+  myPSMapper->SetPointSpriteMagnification( theMagnification / 100.0 );
 
   Modified();
 }
 
-//----------------------------------------------------------------------------
-float
-VISU_GaussPointsPL
-::GetMagnification()
-{
-  return myPSMapper->GetPointSpriteMagnification();
-}
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
@@ -293,13 +283,18 @@ VISU_GaussPointsPL
 {
   myMagnificationIncrement = theIncrement;
 }
+
 //----------------------------------------------------------------------------
-float
+void
 VISU_GaussPointsPL
-::GetMagnificationIncrement()
+::SetAlphaThreshold(float theAlphaThreshold)
 {
-  return myMagnificationIncrement;
+  myAlphaThreshold = theAlphaThreshold;
+  myPSMapper->SetPointSpriteAlphaThreshold( theAlphaThreshold );
+
+  Modified();
 }
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
@@ -308,55 +303,38 @@ VISU_GaussPointsPL
   float anIncrement = up ? myMagnificationIncrement : -myMagnificationIncrement;
   SetMagnification( GetMagnification() + anIncrement );
 }
+
 //----------------------------------------------------------------------------
 float
 VISU_GaussPointsPL
 ::GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray)
 {
-  float aMaxSize = myAverageCellSize*myRelativeMaxSize;
-  float aMinSize = myAverageCellSize*myRelativeMinSize;
+  float aMaxSize = myAverageCellSize*myMaxSize/100.0;
+  float aMinSize = myAverageCellSize*myMinSize/100.0;
   float aDelta = aMaxSize - aMinSize;
   float aVal = theScalarArray->GetTuple1(theID);
 
   return aMinSize + aDelta*(aVal - mySourceScalarRange[0])/myDeltaScalarRange;
 }
 
-//----------------------------------------------------------------------------
-float
-VISU_GaussPointsPL
-::GetPointSize(vtkIdType theID)
-{
-  vtkMapper* aMapper = GetMapper();
-  vtkDataSet* aDataSet = aMapper->GetInput();
-  vtkCellData* aCellData = aDataSet->GetCellData();
-  vtkDataArray* aScalarArray = aCellData->GetScalars();
-  return GetPointSize(theID,aScalarArray);
-}
-
 //----------------------------------------------------------------------------
 float
 VISU_GaussPointsPL
 ::GetMaxPointSize()
 {
-  return myAverageCellSize*myRelativeMaxSize;
-}
-
-//----------------------------------------------------------------------------
-void
-VISU_GaussPointsPL
-::SetAlphaThreshold(float theAlphaThreshold)
-{
-  myPSMapper->SetPointSpriteAlphaThreshold( theAlphaThreshold );
-
-  Modified();
+  return myAverageCellSize*myMaxSize/100.0;
 }
 
 //----------------------------------------------------------------------------
 float
 VISU_GaussPointsPL
-::GetAlphaThreshold()
+::GetPointSize(vtkIdType theID)
 {
-  return myPSMapper->GetPointSpriteAlphaThreshold();
+  vtkMapper* aMapper = GetMapper();
+  vtkDataSet* aDataSet = aMapper->GetInput();
+  vtkCellData* aCellData = aDataSet->GetCellData();
+  vtkDataArray* aScalarArray = aCellData->GetScalars();
+  return GetPointSize(theID,aScalarArray);
 }
 
 //----------------------------------------------------------------------------
index d07188e3ea1f82f2600b62fd78be2294bd0a48be..ffe339f69d9ccd4a4236a0de5389851f33d69255 100644 (file)
@@ -90,71 +90,62 @@ public:
   bool
   GetBicolor();
 
+  float 
+  GetMaximumSupportedSize();
+
   void
   SetClamp(float theClamp);
 
   float
-  GetClamp();
-
-  float 
-  GetMaximumSupportedSize();
+  GetClamp() { return myClamp; }
 
   void
-  SetRelativeSize(float theRelativeSize);
+  SetSize(float theSize);
 
   float 
-  GetRelativeSize()
-  {
-    return myRelativeSize;
-  }
+  GetSize() { return mySize; }
 
   void
-  SetRelativeMinSize(float theRelativeMinSize);
+  SetMinSize(float theMinSize);
 
   float 
-  GetRelativeMinSize()
-  {
-    return myRelativeMinSize;
-  }
+  GetMinSize() { return myMinSize; }
 
   void
-  SetRelativeMaxSize(float theRelativeMaxSize);
+  SetMaxSize(float theMaxSize);
 
   float 
-  GetRelativeMaxSize()
-  {
-    return myRelativeMaxSize;
-  }
-
-  float
-  GetMaxPointSize();
+  GetMaxSize() { return myMaxSize; }
 
   void
   SetMagnification(float theMagnification);
 
   float
-  GetMagnification();
+  GetMagnification() { return myMagnification; }
 
   void
   SetMagnificationIncrement(float theIncrement);
 
   float
-  GetMagnificationIncrement();
+  GetMagnificationIncrement() { return myMagnificationIncrement; }
 
   void
-  ChangeMagnification( bool up );
+  SetAlphaThreshold(float theAlphaThreshold);
 
   float
-  GetPointSize(vtkIdType theID);
+  GetAlphaThreshold() { return myAlphaThreshold; }
+
+  void
+  ChangeMagnification( bool up );
 
   float
-  GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
+  GetMaxPointSize();
 
-  void
-  SetAlphaThreshold(float theAlphaThreshold);
+  float
+  GetPointSize(vtkIdType theID);
 
   float
-  GetAlphaThreshold();
+  GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
 
   void
   SetImageData(vtkImageData* theImageData);
@@ -173,10 +164,14 @@ protected:
   float mySourceScalarRange[2];
   float myDeltaScalarRange;
   float myAverageCellSize;
-  float myRelativeSize;
-  float myRelativeMinSize;
-  float myRelativeMaxSize;
+
+  float myClamp;
+  float mySize;
+  float myMinSize;
+  float myMaxSize;
+  float myMagnification;
   float myMagnificationIncrement;
+  float myAlphaThreshold;
 };
   
 #endif