Commit 654a3ecb authored by Julien Finet's avatar Julien Finet Committed by Marcus D. Hanwell

BUG:When a transfer function is set, update its bounds(via the shape)

parent 3c09f8dd
......@@ -69,6 +69,7 @@ void vtkColorTransferFunctionItem::SetColorTransferFunction(vtkColorTransferFunc
{
t->AddObserver(vtkCommand::ModifiedEvent, this->Callback);
}
this->ScalarsToColorsModified(t, vtkCommand::ModifiedEvent, 0);
}
//-----------------------------------------------------------------------------
......@@ -86,7 +87,6 @@ void vtkColorTransferFunctionItem::ComputeTexture()
vtkWarningMacro(<< "The color transfer function seems empty");
return;
}
// Could depend of the screen resolution
const int dimension = 256;
double* values = new double[dimension];
......@@ -134,6 +134,7 @@ void vtkColorTransferFunctionItem::ScalarsToColorsModified(vtkObject* object,
this->Shape->SetPoint(1, range[0], bounds[3]);
this->Shape->SetPoint(2, range[1], bounds[3]);
this->Shape->SetPoint(3, range[1], bounds[2]);
this->Shape->Modified();
}
// Internally calls modified to ask for a refresh of the item
this->Superclass::ScalarsToColorsModified(object, eid, calldata);
......
......@@ -69,6 +69,7 @@ void vtkCompositeTransferFunctionItem::SetOpacityFunction(vtkPiecewiseFunction*
{
opacity->AddObserver(vtkCommand::ModifiedEvent, this->Callback);
}
this->ScalarsToColorsModified(this->OpacityFunction, vtkCommand::ModifiedEvent, 0);
}
//-----------------------------------------------------------------------------
......@@ -159,6 +160,7 @@ void vtkCompositeTransferFunctionItem::ScalarsToColorsModified(vtkObject* object
this->Shape->SetPoint(1, newRange[0], 1.);
this->Shape->SetPoint(2, newRange[1], 1.);
this->Shape->SetPoint(3, newRange[1], 0.);
this->Shape->Modified();
}
// Internally calls modified to ask for a refresh of the item
this->vtkScalarsToColorsItem::ScalarsToColorsModified(object, eid, calldata);
......
......@@ -67,6 +67,7 @@ void vtkLookupTableItem::SetLookupTable(vtkLookupTable* t)
{
t->AddObserver(vtkCommand::ModifiedEvent, this->Callback);
}
this->ScalarsToColorsModified(this->LookupTable, vtkCommand::ModifiedEvent, 0);
}
//-----------------------------------------------------------------------------
......@@ -129,6 +130,7 @@ void vtkLookupTableItem::ScalarsToColorsModified(vtkObject* object,
this->Shape->SetPoint(1, range[0], bounds[3]);
this->Shape->SetPoint(2, range[1], bounds[3]);
this->Shape->SetPoint(3, range[1], bounds[2]);
this->Shape->Modified();
}
// Internally calls modified to ask for a refresh of the item
this->Superclass::ScalarsToColorsModified(object, eid, calldata);
......
......@@ -71,6 +71,7 @@ void vtkPiecewiseFunctionItem::SetPiecewiseFunction(vtkPiecewiseFunction* t)
{
t->AddObserver(vtkCommand::ModifiedEvent, this->Callback);
}
this->ScalarsToColorsModified(this->PiecewiseFunction, vtkCommand::ModifiedEvent, 0);
}
//-----------------------------------------------------------------------------
......@@ -87,6 +88,7 @@ void vtkPiecewiseFunctionItem::SetMaskAboveCurve(bool mask)
this->Shape->SetPoint(1, 1.f, 0.f);
this->Shape->SetPoint(2, 1.f, 1.f);
this->Shape->SetPoint(3, 0.f, 1.f);
this->Shape->Modified();
}
this->MaskAboveCurve = mask;
this->Modified();
......@@ -124,19 +126,7 @@ void vtkPiecewiseFunctionItem::ComputeTexture()
reinterpret_cast<unsigned char*>(this->Texture->GetScalarPointer(0,0,0));
if (MaskAboveCurve)
{
/*
this->Shape->SetNumberOfPoints(dimension + 4);
this->Shape->SetPoint(0, 0.f, 0.f);
this->Shape->SetPoint(1, 0.f, values[0]);
this->Shape->SetPoint(dimension + 2, 1.f, values[dimension-1]);
this->Shape->SetPoint(dimension + 3, 1.f, 0.f);
*/
this->Shape->SetNumberOfPoints(dimension);
/*
this->Shape->SetNumberOfPoints(dimension + 2);
this->Shape->SetPoint(0, bounds[0], 0.f);
this->Shape->SetPoint(dimension + 1, bounds[1], 0.f);
*/
for (int i = 0; i < dimension; ++i)
{
this->Pen->GetColor(ptr);
......@@ -146,6 +136,7 @@ void vtkPiecewiseFunctionItem::ComputeTexture()
values[i] * 1.f);
ptr+=4;
}
this->Shape->Modified();
}
else
{
......@@ -180,6 +171,7 @@ void vtkPiecewiseFunctionItem::ScalarsToColorsModified(vtkObject* object,
this->Shape->SetPoint(1, range[0], 1.);
this->Shape->SetPoint(2, range[1], 1.);
this->Shape->SetPoint(3, range[1], 0.);
this->Shape->Modified();
}
// Internally calls modified to ask for a refresh of the item
this->Superclass::ScalarsToColorsModified(object, eid, calldata);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment