cout << "before filter limits set" << endl;
vtkObject::GlobalWarningDisplayOn();
aPresent->DebugOn();
- aPresent->SetScalarFilteredRange( aRange );
+ aPresent->SetScalarFilterRange( aRange );
aPresent->UseScalarFiltering( true );
cout << "after filter set" << endl;
if ( theIsCopyInput ) {
SetScalarRange( aPipeLine->GetScalarRange() );
if ( this->IsScalarFilterUsed() )
- SetScalarFilteredRange( aPipeLine->GetScalarFilteredRange() );
+ SetScalarFilterRange( aPipeLine->GetScalarFilterRange() );
}
SetScalarMode(aPipeLine->GetScalarMode());
//----------------------------------------------------------------------------
void
VISU_ColoredPL
-::SetScalarFilteredRange( vtkFloatingPointType theRange[2] )
+::SetScalarFilterRange( vtkFloatingPointType theRange[2] )
{
vtkFloatingPointType aRange[ 2 ];
- this->GetScalarFilteredRange( aRange );
+ this->GetScalarFilterRange( aRange );
if ( VISU::CheckIsSameRange( aRange, theRange) )
return;
//----------------------------------------------------------------------------
void
VISU_ColoredPL
-::GetScalarFilteredRange( vtkFloatingPointType theRange[2] )
+::GetScalarFilterRange( vtkFloatingPointType theRange[2] )
{
theRange[ 0 ] = myThreshold->GetLowerThreshold();
theRange[ 1 ] = myThreshold->GetUpperThreshold();
//----------------------------------------------------------------------------
vtkFloatingPointType*
VISU_ColoredPL
-::GetScalarFilteredRange()
+::GetScalarFilterRange()
{
static vtkFloatingPointType aRange[ 2 ];
- this->GetScalarFilteredRange( aRange );
+ this->GetScalarFilterRange( aRange );
return aRange;
}
GetSourceRange( aRange );
SetScalarRange( aRange );
- SetScalarFilteredRange( aRange );
+ SetScalarFilterRange( aRange );
}
//----------------------------------------------------------------------------
VISU_ColoredPL
::GetClippedInput()
{
-/* RKV if(GetFieldTransformFilter()->GetInput())
- GetFieldTransformFilter()->Update();
- return GetFieldTransformFilter()->GetUnstructuredGridOutput();
- */
- // RKV : Begin
- // The pass filter is used here for possibility to include/exclude
- // threshold filter before it.
if(myPassFilter->GetInput())
- myPassFilter->Update();
+ myPassFilter->Update();
return myPassFilter->GetUnstructuredGridOutput();
- // RKV : End
}
SetScalarRange( vtkFloatingPointType theRange[2] );
void
- SetScalarFilteredRange( vtkFloatingPointType theRange[2] );
+ SetScalarFilterRange( vtkFloatingPointType theRange[2] );
void
- GetScalarFilteredRange( vtkFloatingPointType theRange[2] );
+ GetScalarFilterRange( vtkFloatingPointType theRange[2] );
vtkFloatingPointType*
- GetScalarFilteredRange();
+ GetScalarFilterRange();
bool
IsScalarFilterUsed();
using namespace std;
+
+//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_LookupTable);
+
+//----------------------------------------------------------------------------
VISU_LookupTable
::VISU_LookupTable(int sze, int ext):
vtkLookupTable(sze, ext),
myBicolor(false)
{}
+//----------------------------------------------------------------------------
+namespace
+{
+ inline
+ void
+ CopyColor( unsigned char* theTaget, const unsigned char* theSource )
+ {
+ theTaget[0] = theSource[0];
+ theTaget[1] = theSource[1];
+ theTaget[2] = theSource[2];
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_LookupTable
+::MarkValueByColor( vtkFloatingPointType theValue,
+ unsigned char* theColor )
+{
+ vtkIdType anIndex = this->GetIndex( theValue );
+ unsigned char *aTablePtr = this->GetPointer( anIndex );
+ CopyColor( aTablePtr, theColor );
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_LookupTable
+::FillByColor( unsigned char* theColor )
+{
+ vtkIdType aNbColors = this->GetNumberOfColors();
+ for(int i = 0; i < aNbColors; i++){
+ unsigned char *aTablePtr = this->GetPointer(i);
+ CopyColor( aTablePtr, theColor );
+ }
+}
+
+
+//----------------------------------------------------------------------------
+void
+VISU_LookupTable
+::MakeBiColor()
+{
+ unsigned char aRedPtr[3] = {255, 0, 0};
+ unsigned char aBluePtr[3] = {0, 0, 255};
+
+ vtkFloatingPointType aRange[2];
+ this->GetTableRange(aRange);
+ vtkIdType aNbColors = this->GetNumberOfColors();
+
+ vtkFloatingPointType aDelta = (aRange[1]-aRange[0])/aNbColors;
+ vtkFloatingPointType aValue = aRange[0]+0.5*aDelta;
+ for(int i = 0; i < aNbColors; i++){
+ vtkIdType anIndex = this->GetIndex(aValue);
+ unsigned char* aTablePtr = this->GetPointer(anIndex);
+ if(aValue > 0.0){
+ CopyColor(aTablePtr,aRedPtr);
+ }else{
+ CopyColor(aTablePtr,aBluePtr);
+ }
+ aValue += aDelta;
+ }
+}
+
+
+//----------------------------------------------------------------------------
void
VISU_LookupTable
::SetMapScale(vtkFloatingPointType theScale)
bool GetBicolor() { return myBicolor; }
void SetBicolor( bool theBicolor );
- static int ComputeLogRange(vtkFloatingPointType inRange[2], vtkFloatingPointType outRange[2]);
- unsigned char *MapValue(vtkFloatingPointType v);
+ static int ComputeLogRange( vtkFloatingPointType inRange[2],
+ vtkFloatingPointType outRange[2] );
+
+ unsigned char *MapValue(vtkFloatingPointType v);
+
+ void MarkValueByColor( vtkFloatingPointType theValue,
+ unsigned char* theColor );
+
+ void FillByColor( unsigned char* theColor );
+
+ void MakeBiColor();
protected:
VISU_LookupTable(int sze=256, int ext=256);
#include <string.h>
-//----------------------------------------------------------------------------
-namespace
-{
- inline
- void
- MarkValueByColor(VISU_LookupTable* theTable,
- vtkFloatingPointType theValue,
- unsigned char* theColor)
- {
- vtkIdType anIndex = theTable->GetIndex(theValue);
- unsigned char *aTablePtr = theTable->GetPointer(anIndex);
- aTablePtr[0] = theColor[0];
- aTablePtr[1] = theColor[1];
- aTablePtr[2] = theColor[2];
- }
-
- inline
- void
- CopyColor(unsigned char* theTaget, const unsigned char* theSource)
- {
- theTaget[0] = theSource[0];
- theTaget[1] = theSource[1];
- theTaget[2] = theSource[2];
- }
-
- void
- FillByColor(VISU_LookupTable* theTable,
- unsigned char* theColor)
- {
- vtkIdType aNbColors = theTable->GetNumberOfColors();
- for(int i = 0; i < aNbColors; i++){
- unsigned char *aTablePtr = theTable->GetPointer(i);
- CopyColor(aTablePtr,theColor);
- }
- }
-
- void
- MakeBiColor(VISU_LookupTable* theTable)
- {
- unsigned char aRedPtr[3] = {255, 0, 0};
- unsigned char aBluePtr[3] = {0, 0, 255};
-
- vtkFloatingPointType aRange[2];
- theTable->GetTableRange(aRange);
- vtkIdType aNbColors = theTable->GetNumberOfColors();
-
- vtkFloatingPointType aDelta = (aRange[1]-aRange[0])/aNbColors;
- vtkFloatingPointType aValue = aRange[0]+0.5*aDelta;
- for(int i = 0; i < aNbColors; i++){
- vtkIdType anIndex = theTable->GetIndex(aValue);
- unsigned char* aTablePtr = theTable->GetPointer(anIndex);
- if(aValue > 0.0){
- CopyColor(aTablePtr,aRedPtr);
- }else{
- CopyColor(aTablePtr,aBluePtr);
- }
- aValue += aDelta;
- }
- }
-}
-
-
//----------------------------------------------------------------------------
vtkStandardNewMacro(VISU_ScalarBarCtrl);
{
if(myMarked){
if(myMode == eGlobal){
- MarkValueByColor(myGlobalLookupTable, myMarkedValue, myBlack);
+ myGlobalLookupTable->MarkValueByColor( myMarkedValue, myBlack );
}else{
- MarkValueByColor(myLocalLookupTable, myMarkedValue, myBlack);
+ myLocalLookupTable->MarkValueByColor( myMarkedValue, myBlack );
}
}
if(myGlobalRangeIsDefined){
vtkFloatingPointType aLocalRange[2];
myLocalLookupTable->GetTableRange(aLocalRange);
- MarkValueByColor(myGlobalLookupTable, aLocalRange[0], myBlack);
- MarkValueByColor(myGlobalLookupTable, aLocalRange[1], myBlack);
+ myGlobalLookupTable->MarkValueByColor( aLocalRange[0], myBlack );
+ myGlobalLookupTable->MarkValueByColor( aLocalRange[1], myBlack );
}
}
::UpdateForColor()
{
if(myMode == eGlobal){
- FillByColor(myLocalLookupTable,myGrey);
+ myLocalLookupTable->FillByColor( myGrey );
}else if(myMode == eLocal){
- FillByColor(myGlobalLookupTable,myGrey);
+ myGlobalLookupTable->FillByColor( myGrey );
}
}
myLocalLookupTable->Build();
if(myMode == eSimple){
- MakeBiColor(myLocalLookupTable);
+ myLocalLookupTable->MakeBiColor();
return;
}
if(myMode == eGlobal){
- MakeBiColor(myGlobalLookupTable);
- FillByColor(myLocalLookupTable,myGrey);
+ myGlobalLookupTable->MakeBiColor();
+ myLocalLookupTable->FillByColor( myGrey );
}else if(myMode == eLocal){
- MakeBiColor(myLocalLookupTable);
- FillByColor(myGlobalLookupTable,myGrey);
+ myLocalLookupTable->MakeBiColor();
+ myGlobalLookupTable->FillByColor( myGrey );
}
}
vtkFloatingPointType aScalarRange[ 2 ] = { theMin, theMax };
ProcessVoidEvent(new TVoidMemFun1ArgEvent<VISU_ColoredPL, vtkFloatingPointType*>
- (GetSpecificPL(), &VISU_ColoredPL::SetScalarFilteredRange, aScalarRange) );
+ (GetSpecificPL(), &VISU_ColoredPL::SetScalarFilterRange, aScalarRange) );
}
::GetScalarFilterMin()
{
vtkFloatingPointType aScalarRange[ 2 ];
- GetSpecificPL()->GetScalarFilteredRange( aScalarRange );
+ GetSpecificPL()->GetScalarFilterRange( aScalarRange );
return aScalarRange[ 0 ];
}
::GetScalarFilterMax()
{
vtkFloatingPointType aScalarRange[ 2 ];
- GetSpecificPL()->GetScalarFilteredRange( aScalarRange );
+ GetSpecificPL()->GetScalarFilterRange( aScalarRange );
return aScalarRange[ 1 ];
}
::UpdateActor(VISU_Actor* theActor)
{
if(VISU_ScalarMapAct* anActor = dynamic_cast<VISU_ScalarMapAct*>(theActor)){
+ VISU_LookupTable * aLookupTable = GetSpecificPL()->GetBarTable();
+
+ if ( IsScalarFilterUsed() ) {
+ unsigned char MARK_COLOR[] = { 1, 1, 1 };
+ aLookupTable->MarkValueByColor( GetScalarFilterMin(), MARK_COLOR );
+ aLookupTable->MarkValueByColor( GetScalarFilterMax(), MARK_COLOR );
+ aLookupTable->Modified();
+ }
+
VISU_ScalarBarActor *aScalarBar = anActor->GetScalarBar();
- aScalarBar->SetLookupTable(GetSpecificPL()->GetBarTable());
- // RKV : Begin
- aScalarBar->SetDistribution(GetSpecificPL()->GetDistribution());
- aScalarBar->SetDistributionVisibility(GetIsDistributionVisible());
- // RKV : End
+ aScalarBar->SetLookupTable( aLookupTable );
+
+ aScalarBar->SetDistribution( GetSpecificPL()->GetDistribution() );
+ aScalarBar->SetDistributionVisibility( GetIsDistributionVisible() );
+
aScalarBar->SetTitle(GetScalarBarTitle().c_str());
aScalarBar->SetOrientation(GetBarOrientation());
aScalarBar->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();