Commit c838a080 authored by Jeff Baumes's avatar Jeff Baumes

COMP: Fix warnings.

parent 57db84a1
......@@ -70,7 +70,6 @@ int TestLabelPlacementMapperCoincidentPoints(int argc, char *argv[])
double labelRatio = 1.0;
int i = 0;
int iteratorType = vtkLabelHierarchy::QUEUE;
bool showBounds = true;
vtkSmartPointer<vtkLabelHierarchy> labelHierarchy =
vtkSmartPointer<vtkLabelHierarchy>::New();
......
......@@ -42,11 +42,15 @@ class VTK_RENDERING_EXPORT vtkFreeTypeLabelRenderStrategy : public vtkLabelRende
//BTX
// Description:
// Compute the bounds of a label. Must be performed after the renderer is set.
virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkStdString label, double bds[4])
{ this->Superclass::ComputeLabelBounds(tprop, label, bds); }
virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkUnicodeString label, double bds[4]);
// Description:
// Render a label at a location in world coordinates.
// Must be performed between StartFrame() and EndFrame() calls.
virtual void RenderLabel(double x[3], vtkTextProperty* tprop, vtkStdString label)
{ this->Superclass::RenderLabel(x, tprop, label); }
virtual void RenderLabel(double x[3], vtkTextProperty* tprop, vtkUnicodeString label);
//ETX
......
......@@ -170,7 +170,6 @@ public:
double ax1len = sqrt(Axis[1][0]*Axis[1][0] + Axis[1][1]*Axis[1][1]);
dy[0] = margin*Axis[1][0]/ax1len;
dy[1] = margin*Axis[1][1]/ax1len;
bool rounded = true;
switch (shape)
{
case vtkLabelPlacementMapper::ROUNDED_RECT:
......@@ -335,7 +334,6 @@ public:
/// Is there space to place the given rectangle in this tile so that it doesn't overlap any labels in this tile?
bool IsSpotOpen( const LabelRect& r )
{
float d0, d1, d2, d3;
for ( vtkstd::vector<LabelRect>::iterator it = this->Labels.begin(); it != this->Labels.end(); ++ it )
{
if (r.Overlaps(*it))
......@@ -443,7 +441,7 @@ public:
}
};
vtkCxxRevisionMacro(vtkLabelPlacementMapper, "1.1");
vtkCxxRevisionMacro(vtkLabelPlacementMapper, "1.2");
vtkStandardNewMacro(vtkLabelPlacementMapper);
vtkCxxSetObjectMacro(vtkLabelPlacementMapper, AnchorTransform, vtkCoordinate);
vtkCxxSetObjectMacro(vtkLabelPlacementMapper, RenderStrategy, vtkLabelRenderStrategy);
......@@ -705,8 +703,8 @@ void vtkLabelPlacementMapper::RenderOverlay(vtkViewport *viewport,
}
// Offset display position by lower left corner of bounding box
dispx[0] = origin[0] + bds[0];
dispx[1] = origin[1] + bds[2];
dispx[0] = static_cast<int>(origin[0] + bds[0]);
dispx[1] = static_cast<int>(origin[1] + bds[2]);
sz[0] = bds[1] - bds[0];
sz[1] = bds[3] - bds[2];
......
......@@ -34,13 +34,12 @@
#include <QApplication>
#include <QFont>
#include <QFontMetrics>
#include <QImage>
#include <QPainter>
#include <QTextDocument>
#include <QTextStream>
vtkCxxRevisionMacro(vtkQtLabelRenderStrategy, "1.1");
vtkCxxRevisionMacro(vtkQtLabelRenderStrategy, "1.2");
vtkStandardNewMacro(vtkQtLabelRenderStrategy);
class vtkQtLabelRenderStrategy::Internals
......@@ -125,14 +124,6 @@ void vtkQtLabelRenderStrategy::ComputeLabelBounds(
bds[2] = 0;
bds[3] = tsz.height();
#if 0
QFontMetrics fontMetric(fontSpec);
bds[0] = fontMetric.minLeftBearing();
bds[1] = fontMetric.width(QString::fromUtf8(label.utf8_str()));
bds[2] = fontMetric.descent();
bds[3] = fontMetric.height();
#endif
bds[2] -= tprop->GetLineOffset();
bds[3] -= tprop->GetLineOffset();
......@@ -232,12 +223,6 @@ void vtkQtLabelRenderStrategy::RenderLabel(
QTextStream(&testString) << QString::fromUtf8(label.utf8_str());
//end FIXME
//Qt's coordinate system starts at the top left corner of the layout...
// vtk has been using the text baseline as the starting point, so
// we need to add a correction factor to account for the difference
QFontMetrics fontMetric(fontSpec);
int baseline = fontMetric.ascent();
QTextDocument textDocument;
textDocument.setDefaultFont(fontSpec);
QString styleSheet;
......@@ -298,13 +283,13 @@ void vtkQtLabelRenderStrategy::RenderLabel(
double shadowColor[3];
tprop->GetShadowColor(shadowColor);
QTextDocument textDocument;
textDocument.setDefaultFont(fontSpec);
QTextDocument textDocument2;
textDocument2.setDefaultFont(fontSpec);
QString shadowStyleSheet;
QTextStream(&shadowStyleSheet) << "* { color: rgb( " << shadowColor[0]*255 << ", " << shadowColor[1]*255 << ", " << shadowColor[2]*255 << " ) }";
textDocument.setDefaultStyleSheet(shadowStyleSheet);
textDocument.setHtml(textString);
textDocument.drawContents(painter);
textDocument2.setDefaultStyleSheet(shadowStyleSheet);
textDocument2.setHtml(textString);
textDocument2.drawContents(painter);
painter->restore();
}
......
......@@ -43,11 +43,15 @@ class VTK_RENDERING_EXPORT vtkQtLabelRenderStrategy : public vtkLabelRenderStrat
//BTX
// Description:
// Compute the bounds of a label. Must be performed after the renderer is set.
virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkStdString label, double bds[4])
{ this->Superclass::ComputeLabelBounds(tprop, label, bds); }
virtual void ComputeLabelBounds(vtkTextProperty* tprop, vtkUnicodeString label, double bds[4]);
// Description:
// Render a label at a location in world coordinates.
// Must be performed between StartFrame() and EndFrame() calls.
virtual void RenderLabel(double x[3], vtkTextProperty* tprop, vtkStdString label)
{ this->Superclass::RenderLabel(x, tprop, label); }
virtual void RenderLabel(double x[3], vtkTextProperty* tprop, vtkUnicodeString label);
//ETX
......
......@@ -56,7 +56,7 @@
#include "vtkQtLabelRenderStrategy.h"
#endif
vtkCxxRevisionMacro(vtkRenderView, "1.24");
vtkCxxRevisionMacro(vtkRenderView, "1.25");
vtkStandardNewMacro(vtkRenderView);
vtkCxxSetObjectMacro(vtkRenderView, Transform, vtkAbstractTransform);
vtkCxxSetObjectMacro(vtkRenderView, IconTexture, vtkTexture);
......@@ -64,6 +64,7 @@ vtkCxxSetObjectMacro(vtkRenderView, IconTexture, vtkTexture);
vtkRenderView::vtkRenderView()
{
this->Renderer = vtkRenderer::New();
this->LabelRenderer = vtkRenderer::New();
this->RenderWindow = vtkRenderWindow::New();
vtkTransform* t = vtkTransform::New();
t->Identity();
......@@ -75,6 +76,10 @@ vtkRenderView::vtkRenderView()
this->IconSize[1] = 16;
this->RenderWindow->AddRenderer(this->Renderer);
this->LabelRenderer->EraseOff();
this->LabelRenderer->InteractiveOff();
this->LabelRenderer->SetActiveCamera(this->Renderer->GetActiveCamera());
this->RenderWindow->AddRenderer(this->LabelRenderer);
// We will handle all interactor renders by turning off rendering
// in the interactor and listening to the interactor's render event.
......@@ -94,33 +99,19 @@ vtkRenderView::vtkRenderView()
this->Balloon = vtkSmartPointer<vtkBalloonRepresentation>::New();
this->LabelPlacementMapper = vtkSmartPointer<vtkLabelPlacementMapper>::New();
this->LabelMapper2D = vtkSmartPointer<vtkDynamic2DLabelMapper>::New();
this->LabelActor = vtkSmartPointer<vtkTexturedActor2D>::New();
this->LabelActor->SetMapper(this->LabelPlacementMapper);
this->LabelActor->PickableOff();
this->LabelRenderer->AddActor(this->LabelActor);
this->Balloon->SetBalloonText("");
this->Balloon->SetOffset(1, 1);
this->Renderer->AddViewProp(this->Balloon);
this->Balloon->SetRenderer(this->Renderer);
this->LabelRenderer->AddViewProp(this->Balloon);
this->Balloon->SetRenderer(this->LabelRenderer);
this->Balloon->VisibilityOn();
this->SelectionMode = SURFACE;
this->LabelMapper2D->SetLabelMode(VTK_LABEL_FIELD_DATA);
this->LabelMapper2D->SetFieldDataName("LabelText");
this->LabelMapper2D->SetPriorityArrayName("Priority");
this->LabelMapper2D->SetInputArrayToProcess(0, 0, 0, vtkDataObject::POINT, "ID");
this->LabelActor->PickableOff();
this->Renderer->AddActor(this->LabelActor);
#if 0
this->LabelPlacementMapper->SetShapeToRoundedRect();
this->LabelPlacementMapper->SetStyleToOutline();
this->LabelPlacementMapper->SetMargin(10.0);
this->LabelPlacementMapper->SetBackgroundColor(0.0, 0.0, 0.1);
this->LabelPlacementMapper->SetBackgroundOpacity(0.6);
#endif
// Apply default theme
vtkViewTheme* theme = vtkViewTheme::New();
......@@ -134,6 +125,10 @@ vtkRenderView::~vtkRenderView()
{
this->Renderer->Delete();
}
if (this->LabelRenderer)
{
this->LabelRenderer->Delete();
}
if (this->RenderWindow)
{
this->RenderWindow->Delete();
......
......@@ -231,6 +231,7 @@ protected:
virtual void UpdateHoverText();
vtkRenderer* Renderer;
vtkRenderer* LabelRenderer;
vtkRenderWindow* RenderWindow;
int SelectionMode;
int InteractionMode;
......@@ -243,10 +244,8 @@ protected:
//BTX
vtkSmartPointer<vtkBalloonRepresentation> Balloon;
vtkSmartPointer<vtkLabelPlacementMapper> LabelPlacementMapper;
vtkSmartPointer<vtkTexturedActor2D> LabelActor;
vtkSmartPointer<vtkDynamic2DLabelMapper> LabelMapper2D;
//ETX
private:
......
......@@ -95,7 +95,7 @@
vtkCxxRevisionMacro(vtkRenderedGraphRepresentation, "1.26");
vtkCxxRevisionMacro(vtkRenderedGraphRepresentation, "1.27");
vtkStandardNewMacro(vtkRenderedGraphRepresentation);
vtkRenderedGraphRepresentation::vtkRenderedGraphRepresentation()
......@@ -367,7 +367,7 @@ void vtkRenderedGraphRepresentation::SetVertexIconArrayName(const char* name)
this->ApplyVertexIcons->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_VERTICES, name);
}
void vtkRenderedGraphRepresentation::SetEdgeIconArrayName(const char* name)
void vtkRenderedGraphRepresentation::SetEdgeIconArrayName(const char*)
{
// TODO: Implement.
}
......@@ -384,12 +384,12 @@ const char* vtkRenderedGraphRepresentation::GetEdgeIconArrayName()
return 0;
}
void vtkRenderedGraphRepresentation::SetVertexIconPriorityArrayName(const char* name)
void vtkRenderedGraphRepresentation::SetVertexIconPriorityArrayName(const char*)
{
// TODO: Implement.
}
void vtkRenderedGraphRepresentation::SetEdgeIconPriorityArrayName(const char* name)
void vtkRenderedGraphRepresentation::SetEdgeIconPriorityArrayName(const char*)
{
// TODO: Implement.
}
......@@ -411,7 +411,7 @@ void vtkRenderedGraphRepresentation::SetVertexIconVisibility(bool b)
this->VertexIconActor->SetVisibility(b);
}
void vtkRenderedGraphRepresentation::SetEdgeIconVisibility(bool b)
void vtkRenderedGraphRepresentation::SetEdgeIconVisibility(bool)
{
// TODO: Implement.
}
......@@ -433,7 +433,7 @@ void vtkRenderedGraphRepresentation::AddVertexIconType(const char* name, int typ
this->ApplyVertexIcons->UseLookupTableOn();
}
void vtkRenderedGraphRepresentation::AddEdgeIconType(const char* name, int type)
void vtkRenderedGraphRepresentation::AddEdgeIconType(const char*, int)
{
// TODO: Implement.
}
......@@ -454,7 +454,7 @@ void vtkRenderedGraphRepresentation::SetUseVertexIconTypeMap(bool b)
this->ApplyVertexIcons->SetUseLookupTable(b);
}
void vtkRenderedGraphRepresentation::SetUseEdgeIconTypeMap(bool b)
void vtkRenderedGraphRepresentation::SetUseEdgeIconTypeMap(bool)
{
// TODO: Implement.
}
......
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