18 #include "vtkActor2D.h"
19 #include "vtkCallbackCommand.h"
20 #include "vtkCellArray.h"
21 #include "vtkFloatArray.h"
22 #include "vtkImageData.h"
23 #include "vtkObjectFactory.h"
24 #include "vtkPointData.h"
25 #include "vtkPoints.h"
26 #include "vtkPolyData.h"
27 #include "vtkPolyData.h"
28 #include "vtkPolyDataMapper2D.h"
29 #include "vtkPolyDataMapper2D.h"
30 #include "vtkPropCollection.h"
31 #include "vtkProperty2D.h"
32 #include "vtkRenderer.h"
33 #include "vtkTexture.h"
34 #include "vtkWindow.h"
43 double r0 = borderSize[0] / imageSize[0];
44 double r1 = borderSize[1] / imageSize[1];
60 if (this->GetMTime() > this->BuildTime || (this->Renderer && this->Renderer->GetVTKWindow() &&
61 this->Renderer->GetVTKWindow()->GetMTime() > this->BuildTime))
66 double imageSize[2], borderSize[2], o[2];
70 if (this->
Image->GetDataDimension() == 2)
73 this->
Image->GetDimensions(dims);
74 imageSize[0] =
static_cast<double>(dims[0]);
75 imageSize[1] =
static_cast<double>(dims[1]);
77 int *p1 = this->PositionCoordinate->GetComputedDisplayValue(this->Renderer);
78 int *p2 = this->Position2Coordinate->GetComputedDisplayValue(this->Renderer);
79 borderSize[0] = p2[0];
80 borderSize[1] = p2[1];
81 o[0] =
static_cast<double>(p1[0]);
82 o[1] =
static_cast<double>(p1[1]);
89 this->Texture->SetInputData(this->
Image);
90 int *size = this->Renderer->GetSize();
96 this->TexturePoints->SetPoint(0, o[0], o[1], 0.0);
97 this->TexturePoints->SetPoint(1, o[0] + imageSize[0], o[1], 0.0);
98 this->TexturePoints->SetPoint(2, o[0] + imageSize[0], o[1] + imageSize[1], 0.0);
99 this->TexturePoints->SetPoint(3, o[0], o[1] + imageSize[1], 0.0);
104 o[0] = size[0] - o[0];
105 this->TexturePoints->SetPoint(0, o[0] - imageSize[0], o[1], 0.0);
106 this->TexturePoints->SetPoint(1, o[0], o[1], 0.0);
107 this->TexturePoints->SetPoint(2, o[0], o[1] + imageSize[1], 0.0);
108 this->TexturePoints->SetPoint(3, o[0] - imageSize[0], o[1] + imageSize[1], 0.0);
113 o[0] = size[0] - o[0];
114 o[1] = size[1] - o[1];
115 this->TexturePoints->SetPoint(0, o[0] - imageSize[0], o[1] - imageSize[1], 0.0);
116 this->TexturePoints->SetPoint(1, o[0], o[1] - imageSize[1], 0.0);
117 this->TexturePoints->SetPoint(2, o[0], o[1], 0.0);
118 this->TexturePoints->SetPoint(3, o[0] - imageSize[0], o[1], 0.0);
123 o[1] = size[1] - o[1];
124 this->TexturePoints->SetPoint(0, o[0], o[1] - imageSize[1], 0.0);
125 this->TexturePoints->SetPoint(1, o[0] + imageSize[0], o[1] - imageSize[1], 0.0);
126 this->TexturePoints->SetPoint(2, o[0] + imageSize[0], o[1], 0.0);
127 this->TexturePoints->SetPoint(3, o[0], o[1], 0.0);
134 ish[0] = imageSize[0] / 2.0;
135 ish[1] = imageSize[1] / 2.0;
137 o[0] = (size[0]) / 2.0;
138 o[1] = (size[1]) / 2.0;
139 this->TexturePoints->SetPoint(0, o[0] - ish[0], o[1] - ish[1], 0.0);
140 this->TexturePoints->SetPoint(1, o[0] + ish[0], o[1] - ish[1], 0.0);
141 this->TexturePoints->SetPoint(2, o[0] + ish[0], o[1] + ish[1], 0.0);
142 this->TexturePoints->SetPoint(3, o[0] - ish[0], o[1] + ish[1], 0.0);
147 this->TexturePoints->SetPoint(0, o[0], o[1], 0.0);
148 this->TexturePoints->SetPoint(1, o[0] + imageSize[0], o[1], 0.0);
149 this->TexturePoints->SetPoint(2, o[0] + imageSize[0], o[1] + imageSize[1], 0.0);
150 this->TexturePoints->SetPoint(3, o[0], o[1] + imageSize[1], 0.0);
168 this->Superclass::PrintSelf(os, indent);
172 os << indent <<
"Image:\n";
173 this->
Image->PrintSelf(os, indent.GetNextIndent());
177 os << indent <<
"Image: (none)\n";
180 if (this->ImageProperty)
182 os << indent <<
"Image Property:\n";
183 this->ImageProperty->PrintSelf(os, indent.GetNextIndent());
187 os << indent <<
"Image Property: (none)\n";
void PrintSelf(ostream &os, vtkIndent indent) override
void AdjustImageSize(double o[2], double borderSize[2], double imageSize[2])
virtual void BuildRepresentation() override
mitkVtkLogoRepresentation()
~mitkVtkLogoRepresentation()
vtkStandardNewMacro(mitkVtkLogoRepresentation)