Commit b7c0d1cc authored by David C. Lonie's avatar David C. Lonie
Browse files

Add functions to check if MathText is available at runtime.

bool vtkContext2D::MathTextIsSupported()
bool vtkContextDevice2D::MathTextIsSupported()
bool vtkMathTextActor::IsSupported()
bool vtkMathTextActor3D::IsSupported()

Availablity of MathText can also be check from anywhere using
vtkMathTextUtilities::GetInstance() != NULL.

Change-Id: I288bc94ddfdda578edb2f4618035de68db3c583f
parent 564112e2
......@@ -653,7 +653,7 @@ void vtkContext2D::DrawMathTextString(vtkPoints2D *point,
const vtkStdString &string,
const vtkStdString &fallback)
{
if (this->Device->MathTextIsAvailable())
if (this->Device->MathTextIsSupported())
{
this->DrawMathTextString(point, string);
}
......@@ -668,7 +668,7 @@ void vtkContext2D::DrawMathTextString(float x, float y,
const vtkStdString &string,
const vtkStdString &fallback)
{
if (this->Device->MathTextIsAvailable())
if (this->Device->MathTextIsSupported())
{
this->DrawMathTextString(x, y, string);
}
......@@ -682,7 +682,7 @@ void vtkContext2D::DrawMathTextString(float x, float y,
void vtkContext2D::DrawMathTextString(vtkPoints2D *point, const char *string,
const char *fallback)
{
if (this->Device->MathTextIsAvailable())
if (this->Device->MathTextIsSupported())
{
this->DrawMathTextString(point, string);
}
......@@ -696,7 +696,7 @@ void vtkContext2D::DrawMathTextString(vtkPoints2D *point, const char *string,
void vtkContext2D::DrawMathTextString(float x, float y, const char *string,
const char *fallback)
{
if (this->Device->MathTextIsAvailable())
if (this->Device->MathTextIsSupported())
{
this->DrawMathTextString(x, y, string);
}
......@@ -706,6 +706,12 @@ void vtkContext2D::DrawMathTextString(float x, float y, const char *string,
}
}
//-----------------------------------------------------------------------------
bool vtkContext2D::MathTextIsSupported()
{
return this->Device->MathTextIsSupported();
}
//-----------------------------------------------------------------------------
void vtkContext2D::DrawImage(float x, float y, vtkImageData *image)
{
......
......@@ -316,6 +316,11 @@ public:
void DrawMathTextString(float x, float y, const char *string,
const char *fallback);
// Description:
// Return true if MathText rendering available on the current device.
bool MathTextIsSupported();
// Description:
// Apply the supplied pen which controls the outlines of shapes, as well as
// lines, points and related primitives. This makes a deep copy of the vtkPen
......
......@@ -44,7 +44,7 @@ vtkContextDevice2D::~vtkContextDevice2D()
}
//-----------------------------------------------------------------------------
bool vtkContextDevice2D::MathTextIsAvailable()
bool vtkContextDevice2D::MathTextIsSupported()
{
return vtkMathTextUtilities::GetInstance() != NULL;
}
......
......@@ -137,7 +137,7 @@ public:
// Description:
// Return true if MathText rendering available on this device.
virtual bool MathTextIsAvailable();
virtual bool MathTextIsSupported();
// Description:
// Draw the supplied image at the given x, y (p[0], p[1]) (bottom corner),
......
......@@ -34,6 +34,12 @@
// ----------------------------------------------------------------------------
vtkStandardNewMacro(vtkMathTextActor);
// ----------------------------------------------------------------------------
bool vtkMathTextActor::IsSupported()
{
return vtkMathTextUtilities::GetInstance() != NULL;
}
// ----------------------------------------------------------------------------
vtkMathTextActor::vtkMathTextActor()
{
......
......@@ -44,6 +44,11 @@ public:
void PrintSelf(ostream& os, vtkIndent indent);
static vtkMathTextActor *New();
// Description:
// Returns true if MathText is available on this build of VTK. If false,
// this actor will not function.
bool IsSupported();
// Description:
// Shallow copy of this actor.
void ShallowCopy(vtkProp *prop);
......
......@@ -45,6 +45,12 @@ vtkMathTextActor3D::~vtkMathTextActor3D()
this->SetInput(NULL);
}
// --------------------------------------------------------------------------
bool vtkMathTextActor3D::IsSupported()
{
return vtkMathTextUtilities::GetInstance() != NULL;
}
// --------------------------------------------------------------------------
void vtkMathTextActor3D::ShallowCopy(vtkProp *prop)
{
......
......@@ -44,6 +44,11 @@ public:
vtkTypeMacro(vtkMathTextActor3D,vtkProp3D)
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Returns true if MathText is available on this build of VTK. If false,
// this actor will not function.
bool IsSupported();
// Description:
// Set the text string to be displayed.
vtkSetStringMacro(Input)
......
Supports Markdown
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