Commit 4b0e6daf authored by Marcus Hanwell's avatar Marcus Hanwell
Browse files

COMP: Fixed compilation warnings from some of the new 2D API classes.

parent 80def1ad
......@@ -22,7 +22,7 @@
#include "vtkObjectFactory.h"
//-----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkAxis, "1.1");
vtkCxxRevisionMacro(vtkAxis, "1.2");
//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkAxis);
......@@ -61,8 +61,8 @@ bool vtkAxis::Paint(vtkContext2D *painter)
if (this->Point1[0] == this->Point2[0]) // x1 == x2, therefore vertical
{
// Draw the axis label
int x = this->Point1[0] - 45;
int y = (this->Point1[1] + this->Point2[1]) / 2;
int x = static_cast<int>(this->Point1[0] - 45);
int y = static_cast<int>(this->Point1[1] + this->Point2[1]) / 2;
vtkTextProperty *prop = painter->GetTextProp();
prop->SetFontSize(15);
prop->SetFontFamilyAsString("Arial");
......@@ -112,14 +112,15 @@ bool vtkAxis::Paint(vtkContext2D *painter)
float(this->NumberOfTicks -1);
for (int i = 0; i < this->NumberOfTicks; ++i)
{
int xTick = this->Point1[1] + float(i)*spacing;
int xTick = static_cast<int>(this->Point1[1] + float(i)*spacing);
painter->DrawLine(xTick, this->Point1[1] - 5, xTick, this->Point1[1]);
char string[20];
sprintf(string, "%-#6.3g", this->Minimum + i*labelSpacing);
painter->DrawText(xTick, this->Point1[1] - 5, string);
painter->DrawText(xTick, int(this->Point1[1] - 5), string);
}
}
return true;
}
//-----------------------------------------------------------------------------
......
......@@ -27,7 +27,7 @@
#include "vtkObjectFactory.h"
//-----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkBlockItem, "1.1");
vtkCxxRevisionMacro(vtkBlockItem, "1.2");
vtkStandardNewMacro(vtkBlockItem);
//-----------------------------------------------------------------------------
......@@ -65,8 +65,8 @@ bool vtkBlockItem::Paint(vtkContext2D *painter)
painter->DrawRect(this->Dimensions[0], this->Dimensions[1],
this->Dimensions[2], this->Dimensions[3]);
int x = this->Dimensions[0] + 0.5 * this->Dimensions[2];
int y = this->Dimensions[1] + 0.5 * this->Dimensions[3];
int x = static_cast<int>(this->Dimensions[0] + 0.5 * this->Dimensions[2]);
int y = static_cast<int>(this->Dimensions[1] + 0.5 * this->Dimensions[3]);
painter->DrawText(x, y, this->Label);
if (this->scalarFunction)
......@@ -74,6 +74,7 @@ bool vtkBlockItem::Paint(vtkContext2D *painter)
// We have a function pointer - do something...
;
}
return true;
}
//-----------------------------------------------------------------------------
......@@ -94,7 +95,7 @@ bool vtkBlockItem::Hit(const vtkContextMouseEvent &mouse)
}
//-----------------------------------------------------------------------------
bool vtkBlockItem::MouseEnterEvent(const vtkContextMouseEvent &mouse)
bool vtkBlockItem::MouseEnterEvent(const vtkContextMouseEvent &)
{
this->MouseOver = true;
return true;
......@@ -138,7 +139,7 @@ bool vtkBlockItem::MouseMoveEvent(const vtkContextMouseEvent &mouse)
}
//-----------------------------------------------------------------------------
bool vtkBlockItem::MouseLeaveEvent(const vtkContextMouseEvent &mouse)
bool vtkBlockItem::MouseLeaveEvent(const vtkContextMouseEvent &)
{
this->MouseOver = false;
return true;
......@@ -154,15 +155,15 @@ bool vtkBlockItem::MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
}
//-----------------------------------------------------------------------------
bool vtkBlockItem::MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
bool vtkBlockItem::MouseButtonReleaseEvent(const vtkContextMouseEvent &)
{
this->MouseButtonPressed = -1;
return true;
}
void vtkBlockItem::SetScalarFunctor(double (*scalarFunction)(double, double))
void vtkBlockItem::SetScalarFunctor(double (*ScalarFunction)(double, double))
{
this->scalarFunction = scalarFunction;
this->scalarFunction = ScalarFunction;
}
//-----------------------------------------------------------------------------
......
......@@ -93,7 +93,7 @@ protected:
int Dimensions[4];
int LastPosition[2];
float LastPosition[2];
char *Label;
......
......@@ -18,7 +18,7 @@
#include "vtkObjectFactory.h"
//-----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkBrush, "1.1");
vtkCxxRevisionMacro(vtkBrush, "1.2");
//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkBrush);
......@@ -40,32 +40,32 @@ vtkBrush::~vtkBrush()
//-----------------------------------------------------------------------------
void vtkBrush::SetColorF(double color[3])
{
this->Color[0] = color[0] * 255.0;
this->Color[1] = color[1] * 255.0;
this->Color[2] = color[2] * 255.0;
this->Color[0] = static_cast<unsigned char>(color[0] * 255.0);
this->Color[1] = static_cast<unsigned char>(color[1] * 255.0);
this->Color[2] = static_cast<unsigned char>(color[2] * 255.0);
}
//-----------------------------------------------------------------------------
void vtkBrush::SetColorF(double r, double g, double b)
{
this->Color[0] = r * 255.0;
this->Color[1] = g * 255.0;
this->Color[2] = b * 255.0;
this->Color[0] = static_cast<unsigned char>(r * 255.0);
this->Color[1] = static_cast<unsigned char>(g * 255.0);
this->Color[2] = static_cast<unsigned char>(b * 255.0);
}
//-----------------------------------------------------------------------------
void vtkBrush::SetColorF(double r, double g, double b, double a)
{
this->Color[0] = r * 255.0;
this->Color[1] = g * 255.0;
this->Color[2] = b * 255.0;
this->Color[3] = a * 255.0;
this->Color[0] = static_cast<unsigned char>(r * 255.0);
this->Color[1] = static_cast<unsigned char>(g * 255.0);
this->Color[2] = static_cast<unsigned char>(b * 255.0);
this->Color[3] = static_cast<unsigned char>(a * 255.0);
}
//-----------------------------------------------------------------------------
void vtkBrush::SetOpacityF(double a)
{
this->Color[3] = a * 255.0;
this->Color[3] = static_cast<unsigned char>(a * 255.0);
}
//-----------------------------------------------------------------------------
......
......@@ -54,7 +54,7 @@ private:
};
//-----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkChart, "1.1");
vtkCxxRevisionMacro(vtkChart, "1.2");
vtkCxxSetObjectMacro(vtkChart, AnnotationLink, vtkAnnotationLink);
//-----------------------------------------------------------------------------
......@@ -72,7 +72,7 @@ vtkChart::~vtkChart()
}
//-----------------------------------------------------------------------------
vtkPlot * vtkChart::AddPlot(Type type)
vtkPlot * vtkChart::AddPlot(Type)
{
return NULL;
}
......@@ -91,7 +91,7 @@ void vtkChart::AddInteractorStyle(vtkInteractorStyle *interactor)
//-----------------------------------------------------------------------------
void vtkChart::ProcessEvents(vtkObject* caller, unsigned long eventId,
void* callData)
void*)
{
cout << "ProcessEvents called! " << caller->GetClassName() << "\t"
<< vtkCommand::GetStringFromEventId(eventId)
......
......@@ -56,7 +56,7 @@ class vtkChartXYPrivate
};
//-----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkChartXY, "1.1");
vtkCxxRevisionMacro(vtkChartXY, "1.2");
//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkChartXY);
......@@ -106,8 +106,6 @@ void vtkChartXY::SetGeometry(int *p)
vtkChart::SetGeometry(p);
// This is where we set the axes up too
float p1[] = { p[2], p[3], p[0]-p[4], p[3] };
float p2[] = { p[2], p[3], p[2], p[1]-p[5] };
this->XAxis->SetPoint1(p[2] , p[3] );
this->XAxis->SetPoint2(p[0]-p[4], p[3] );
this->YAxis->SetPoint1(p[2] , p[3] );
......@@ -168,8 +166,8 @@ bool vtkChartXY::Paint(vtkContext2D *painter)
// Clip drawing while plotting
int clip[4];
clip[0] = xOrigin;
clip[1] = yOrigin;
clip[0] = static_cast<int>(xOrigin);
clip[1] = static_cast<int>(yOrigin);
clip[2] = this->Geometry[0] - this->Geometry[4] - this->Geometry[2];
clip[3] = this->Geometry[1] - this->Geometry[5] - this->Geometry[3];
painter->GetDevice()->SetClipping(&clip[0]);
......@@ -191,6 +189,8 @@ bool vtkChartXY::Paint(vtkContext2D *painter)
painter->GetPen()->SetWidth(1.0);
this->XAxis->Paint(painter);
this->YAxis->Paint(painter);
return true;
}
//-----------------------------------------------------------------------------
......@@ -262,7 +262,10 @@ vtkPlot * vtkChartXY::AddPlot(vtkChart::Type type)
return points;
break;
}
default:
return NULL;
}
return NULL;
}
//-----------------------------------------------------------------------------
......@@ -330,9 +333,6 @@ void vtkChartXY::ProcessSelectionEvent(vtkObject* caller, void* callData)
this->XAxis->SetMaximum(tRect[2]);
this->YAxis->SetMinimum(tRect[1]);
this->YAxis->SetMaximum(tRect[3]);
// Now re-render the chart
vtkInteractorStyle *interactor = reinterpret_cast<vtkInteractorStyle *>(caller);
}
......
......@@ -28,7 +28,7 @@
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
vtkCxxRevisionMacro(vtkContext2D, "1.1");
vtkCxxRevisionMacro(vtkContext2D, "1.2");
vtkCxxSetObjectMacro(vtkContext2D, Pen, vtkPen);
vtkCxxSetObjectMacro(vtkContext2D, Brush, vtkBrush);
vtkCxxSetObjectMacro(vtkContext2D, TextProp, vtkTextProperty);
......@@ -42,6 +42,7 @@ bool vtkContext2D::Begin(vtkContextDevice2D *device)
{
this->Device = device;
this->Modified();
return true;
}
//-----------------------------------------------------------------------------
......@@ -50,6 +51,7 @@ bool vtkContext2D::End()
this->Device->End();
this->Device = NULL;
this->Modified();
return true;
}
//-----------------------------------------------------------------------------
......@@ -337,6 +339,7 @@ void vtkContext2D::DrawImage(float x, float y, vtkImageData *image)
unsigned int vtkContext2D::AddPointSprite(vtkImageData *image)
{
this->Device->AddPointSprite(image);
return 0;
}
//-----------------------------------------------------------------------------
......
......@@ -22,7 +22,7 @@
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkContextActor, "1.1");
vtkCxxRevisionMacro(vtkContextActor, "1.2");
vtkStandardNewMacro(vtkContextActor);
vtkCxxSetObjectMacro(vtkContextActor, Context, vtkContext2D);
......@@ -60,7 +60,7 @@ vtkContextActor::~vtkContextActor()
}
//----------------------------------------------------------------------------
void vtkContextActor::ReleaseGraphicsResources(vtkWindow *win)
void vtkContextActor::ReleaseGraphicsResources(vtkWindow *)
{
}
......
......@@ -50,7 +50,7 @@ public:
// Description:
// Draw a quad using the specified number of points.
virtual void DrawQuad(float *points, int n) { ; }
virtual void DrawQuad(float *, int) { ; }
//BTX
// Description:
......@@ -61,11 +61,11 @@ public:
// Description:
// Draw the supplied image at the given x, y (p[0], p[1]) location(s) (bottom corner).
virtual void DrawImage(float *p, int n, vtkImageData *image) {;}
virtual void DrawImage(float *p, int n, vtkImageData *) {;}
// Description:
// Experimentation with point sprites
virtual unsigned int AddPointSprite(vtkImageData *image) {;}
virtual unsigned int AddPointSprite(vtkImageData *) { return 0; }
// Description:
// Set the color for the device using unsigned char of length 4, RGBA.
......@@ -115,7 +115,7 @@ public:
// Description:
// Begin drawing, pass in the viewport to set up the view.
virtual void Begin(vtkViewport* viewport) { }
virtual void Begin(vtkViewport*) { }
// Description:
// End drawing, clean up the view.
......
......@@ -25,7 +25,7 @@
#include "vtkObjectFactory.h"
//-----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkContextItem, "1.1");
vtkCxxRevisionMacro(vtkContextItem, "1.2");
vtkCxxSetObjectMacro(vtkContextItem, Transform, vtkTransform2D)
//-----------------------------------------------------------------------------
......@@ -46,37 +46,37 @@ vtkContextItem::~vtkContextItem()
}
//-----------------------------------------------------------------------------
bool vtkContextItem::Hit(const vtkContextMouseEvent &mouse)
bool vtkContextItem::Hit(const vtkContextMouseEvent &)
{
return false;
}
//-----------------------------------------------------------------------------
bool vtkContextItem::MouseEnterEvent(const vtkContextMouseEvent &mouse)
bool vtkContextItem::MouseEnterEvent(const vtkContextMouseEvent &)
{
return false;
}
//-----------------------------------------------------------------------------
bool vtkContextItem::MouseMoveEvent(const vtkContextMouseEvent &mouse)
bool vtkContextItem::MouseMoveEvent(const vtkContextMouseEvent &)
{
return false;
}
//-----------------------------------------------------------------------------
bool vtkContextItem::MouseLeaveEvent(const vtkContextMouseEvent &mouse)
bool vtkContextItem::MouseLeaveEvent(const vtkContextMouseEvent &)
{
return false;
}
//-----------------------------------------------------------------------------
bool vtkContextItem::MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
bool vtkContextItem::MouseButtonPressEvent(const vtkContextMouseEvent &)
{
return false;
}
//-----------------------------------------------------------------------------
bool vtkContextItem::MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
bool vtkContextItem::MouseButtonReleaseEvent(const vtkContextMouseEvent &)
{
return false;
}
......
......@@ -100,7 +100,7 @@ public:
};
//-----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkContextScene, "1.1");
vtkCxxRevisionMacro(vtkContextScene, "1.2");
vtkStandardNewMacro(vtkContextScene);
vtkCxxSetObjectMacro(vtkContextScene, AnnotationLink, vtkAnnotationLink);
vtkCxxSetObjectMacro(vtkContextScene, Window, vtkRenderWindow);
......@@ -135,6 +135,7 @@ bool vtkContextScene::Paint(vtkContext2D *painter)
painter->SetTransform(this->Storage->items[i]->GetTransform());
this->Storage->items[i]->Paint(painter);
}
return true;
}
//-----------------------------------------------------------------------------
......@@ -169,7 +170,7 @@ void vtkContextScene::SetInteractorStyle(vtkInteractorStyle *interactor)
//-----------------------------------------------------------------------------
void vtkContextScene::ProcessEvents(vtkObject* caller, unsigned long eventId,
void* callData)
void*)
{
vtkDebugMacro("ProcessEvents called! " << caller->GetClassName() << "\t"
<< vtkCommand::GetStringFromEventId(eventId)
......
......@@ -18,7 +18,7 @@
#include "vtkObjectFactory.h"
//-----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkPen, "1.1");
vtkCxxRevisionMacro(vtkPen, "1.2");
//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPen);
......@@ -40,32 +40,32 @@ vtkPen::~vtkPen()
//-----------------------------------------------------------------------------
void vtkPen::SetColorF(double color[3])
{
this->Color[0] = color[0] * 255.0;
this->Color[1] = color[1] * 255.0;
this->Color[2] = color[2] * 255.0;
this->Color[0] = static_cast<unsigned char>(color[0] * 255.0);
this->Color[1] = static_cast<unsigned char>(color[1] * 255.0);
this->Color[2] = static_cast<unsigned char>(color[2] * 255.0);
}
//-----------------------------------------------------------------------------
void vtkPen::SetColorF(double r, double g, double b)
{
this->Color[0] = r * 255.0;
this->Color[1] = g * 255.0;
this->Color[2] = b * 255.0;
this->Color[0] = static_cast<unsigned char>(r * 255.0);
this->Color[1] = static_cast<unsigned char>(g * 255.0);
this->Color[2] = static_cast<unsigned char>(b * 255.0);
}
//-----------------------------------------------------------------------------
void vtkPen::SetColorF(double r, double g, double b, double a)
{
this->Color[0] = r * 255.0;
this->Color[1] = g * 255.0;
this->Color[2] = b * 255.0;
this->Color[3] = a * 255.0;
this->Color[0] = static_cast<unsigned char>(r * 255.0);
this->Color[1] = static_cast<unsigned char>(g * 255.0);
this->Color[2] = static_cast<unsigned char>(b * 255.0);
this->Color[3] = static_cast<unsigned char>(a * 255.0);
}
//-----------------------------------------------------------------------------
void vtkPen::SetOpacityF(double a)
{
this->Color[3] = a * 255.0;
this->Color[3] = static_cast<unsigned char>(a * 255.0);
}
//-----------------------------------------------------------------------------
......
......@@ -23,16 +23,16 @@
#include "vtkStdString.h"
vtkCxxRevisionMacro(vtkPlot, "1.1");
vtkCxxRevisionMacro(vtkPlot, "1.2");
vtkCxxSetObjectMacro(vtkPlot, Selection, vtkIdTypeArray);
//-----------------------------------------------------------------------------
vtkPlot::vtkPlot()
{
this->r = 0;
this->g = 0;
this->b = 0;
this->a = 0;
this->Color[0] = 0;
this->Color[1] = 0;
this->Color[2] = 0;
this->Color[3] = 0;
this->Width = 1.0;
this->Data = vtkContextMapper2D::New();
this->Selection = NULL;
......@@ -52,10 +52,10 @@ vtkPlot::~vtkPlot()
void vtkPlot::SetColor(unsigned char r, unsigned char g, unsigned char b,
unsigned char a)
{
this->r = r;
this->g = g;
this->b = b;
this->a = a;
this->Color[0] = r;
this->Color[1] = g;
this->Color[2] = b;
this->Color[3] = a;
}
//-----------------------------------------------------------------------------
......@@ -104,7 +104,7 @@ void vtkPlot::PrintSelf(ostream &os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
// Print out our color and width
os << indent << "Color: " << this->r << ", " << this->g
<< ", " << this->b << ", " << this->a << endl;
os << indent << "Color: " << this->Color[0] << ", " << this->Color[1]
<< ", " << this->Color[2] << ", " << this->Color[3] << endl;
os << indent << "Width: " << this->Width << endl;
}
......@@ -84,7 +84,7 @@ protected:
vtkPlot();
~vtkPlot();
unsigned char r, g, b, a;
unsigned char Color[4];
float Width;
......
......@@ -30,7 +30,7 @@
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkPlotLine, "1.1");
vtkCxxRevisionMacro(vtkPlotLine, "1.2");
//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPlotLine);
......@@ -93,7 +93,8 @@ bool vtkPlotLine::Paint(vtkContext2D *painter)
// Now to plot the points
if (this->Points)
{
painter->GetPen()->SetColor(this->r, this->g, this->b, this->a);
painter->GetPen()->SetColor(this->Color);
painter->GetPen()->SetOpacity(this->Color[3]);
painter->GetPen()->SetWidth(this->Width);
painter->DrawPoly(this->Points);
}
......@@ -183,23 +184,11 @@ bool vtkPlotLine::UpdateTableCache(vtkTable *table)
<< endl << x->GetClassName()
<< "\t" << y->GetClassName());
}
return true;
}
//-----------------------------------------------------------------------------
void vtkPlotLine::PrintSelf(ostream &os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
// Print some details about this plot
os << indent << "Label: ";
if (this->Label)
{
os << "\"" << *this->Label << "\"" << endl;
}
else
{
os << "(none)" << endl;
}
os << indent << "Line Width: " << this->Width << endl;
os << indent << "Color: " << this->r << ", " << this->g
<< ", " << this->b << ", " << this->a << endl;
}
......@@ -30,7 +30,7 @@
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkPlotPoints, "1.1");
vtkCxxRevisionMacro(vtkPlotPoints, "1.2");
//-----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPlotPoints);
......@@ -93,7 +93,8 @@ bool vtkPlotPoints::Paint(vtkContext2D *painter)
// Now to plot the points
if (this->Points)
{
painter->GetPen()->SetColor(this->r, this->g, this->b, this->a);
painter->GetPen()->SetColor(this->Color);
painter->GetPen()->SetOpacity(this->Color[3]);
painter->GetPen()->SetWidth(this->Width);
painter->DrawPoints(this->Points);
}
......@@ -183,23 +184,11 @@ bool vtkPlotPoints::UpdateTableCache(vtkTable *table)
<< endl << x->GetClassName()
<< "\t" << y->GetClassName());
}
return true;
}
//-----------------------------------------------------------------------------
void vtkPlotPoints::PrintSelf(ostream &os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
// Print some details about this plot
os << indent << "Label: ";
if (this->Label)
{
os << "\"" << *this->Label << "\"" << endl;
}
else
{
os << "(none)" << endl;
}
os << indent << "Point size: " << this->Width << endl;
os << indent << "Color: " << this->r << ", " << this->g
<< ", " << this->b << ", " << this->a << endl;
}