void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) {
initFromResources();
myScalarMap = thePrs;
+ myTitle = thePrs->GetTitle();
setPosAndSize( thePrs->GetPosX(),
thePrs->GetPosY(),
thePrs->GetWidth(),
if (myScalarMap == NULL) return;
if (!check()) return;
-
+ myScalarMapPL = VISU_ScalarMapPL::New();
+ if(myScalarMap->GetScalarMapPL())
+ myScalarMapPL->ShallowCopy(myScalarMap->GetScalarMapPL());
+
if ( myBusy ) return;
myBusy = true;
myPreviewActor->GetScalarBar()->VisibilityOn();
myPreviewActor->PickableOff();
- myScalarMap->SetScalarMode(myModeCombo->currentItem());
- myScalarMap->SetPosition(getX(),getY());
- myScalarMap->SetSize(getWidth(),getHeight());
- myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL);
+ myScalarMapPL->SetScalarMode(myModeCombo->currentItem());
if(isLogarithmic())
- myScalarMap->SetScaling(VISU::LOGARITHMIC);
+ myScalarMapPL->SetScaling(VISU::LOGARITHMIC);
else
- myScalarMap->SetScaling(VISU::LINEAR);
- if (RBFrange->isChecked()) {
- myScalarMap->SetSourceRange();
- } else {
- myScalarMap->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble());
- }
- myScalarMap->SetNbColors(sbCol);
- myScalarMap->SetLabels(sbLab);
+ myScalarMapPL->SetScaling(VISU::LINEAR);
+ vtkFloatingPointType theRange[2];
+ theRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble();
+ theRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble();
+ myScalarMapPL->SetScalarRange(theRange);
+ myScalarMapPL->SetNbColors(sbCol);
- myScalarMap->GetScalarMapPL()->SetNbColors(sbCol);
- myScalarMap->GetScalarMapPL()->Update();
-
- aScalarBarActor->SetLookupTable(myScalarMap->GetScalarMapPL()->GetBarTable());
+ myScalarMapPL->Update();
+
+ aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable());
if (myTextDlg->getTitleText().latin1() != "")
aScalarBarActor->SetTitle(myTextDlg->getTitleText().latin1());
else
- aScalarBarActor->SetTitle(myScalarMap->GetTitle());
+ aScalarBarActor->SetTitle(myTitle.c_str());
aScalarBarActor->SetOrientation(getOrientation());
aScalarBarActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
aScalarBarActor->GetPositionCoordinate()->SetValue(getX(),getY());
if ( myBusy ) return;
if (myPreviewActor == 0) return;
- if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>()){
- vf->RemoveActor(myPreviewActor);
- myPreviewActor->GetScalarBar()->VisibilityOff();
- }
+ vtkRenderer* aRend = myPreviewActor->GetRenderer();
+ if(aRend)
+ myPreviewActor->RemoveFromRender(aRend);
+ myPreviewActor->GetScalarBar()->VisibilityOff();
myPreviewActor->Delete();
myPreviewActor = 0;
+
+ if (myScalarMapPL){
+ myScalarMapPL->Delete();
+ myScalarMapPL = 0;
+ }
}
/*! public: Deleting preview scalar bar
*/
void VisuGUI_ScalarBarPane::deletePreview()
{
deleteScalarBar();
+ if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
+ vf->Repaint();
}
/**
* Store values to presentation object
if ( myScalarMap ) {
if ( RBFrange->isChecked() ) {
vtkFloatingPointType aRange[2];
+ int aMode = myScalarMap->GetScalarMode();
myScalarMap->SetScalarMode(theMode);
myScalarMap->GetScalarMapPL()->GetSourceRange(aRange);
MinEdit->setText( QString::number( aRange[0] ) );
MaxEdit->setText( QString::number( aRange[1] ) );
+ myScalarMap->SetScalarMode(aMode);
}
}
+ updatePreview();
}
/*!