14 #include "vtkActor2D.h" 15 #include "vtkCallbackCommand.h" 16 #include "vtkCellArray.h" 17 #include "vtkFloatArray.h" 18 #include "vtkImageData.h" 19 #include "vtkObjectFactory.h" 20 #include "vtkPointData.h" 21 #include "vtkPoints.h" 22 #include "vtkPolyData.h" 23 #include "vtkPolyData.h" 24 #include "vtkPolyDataMapper2D.h" 25 #include "vtkPolyDataMapper2D.h" 26 #include "vtkPropCollection.h" 27 #include "vtkProperty2D.h" 28 #include "vtkRenderer.h" 29 #include "vtkTexture.h" 30 #include "vtkWindow.h" 39 double r0 = borderSize[0] / imageSize[0];
40 double r1 = borderSize[1] / imageSize[1];
56 if (this->GetMTime() > this->BuildTime || (this->Renderer && this->Renderer->GetVTKWindow() &&
57 this->Renderer->GetVTKWindow()->GetMTime() > this->BuildTime))
62 double imageSize[2], borderSize[2], o[2];
66 if (this->
Image->GetDataDimension() == 2)
69 this->
Image->GetDimensions(dims);
70 imageSize[0] =
static_cast<double>(dims[0]);
71 imageSize[1] =
static_cast<double>(dims[1]);
73 int *p1 = this->PositionCoordinate->GetComputedDisplayValue(this->Renderer);
74 int *p2 = this->Position2Coordinate->GetComputedDisplayValue(this->Renderer);
75 borderSize[0] = p2[0];
76 borderSize[1] = p2[1];
77 o[0] =
static_cast<double>(p1[0]);
78 o[1] =
static_cast<double>(p1[1]);
85 this->Texture->SetInputData(this->
Image);
86 int *size = this->Renderer->GetSize();
92 this->TexturePoints->SetPoint(0, o[0], o[1], 0.0);
93 this->TexturePoints->SetPoint(1, o[0] + imageSize[0], o[1], 0.0);
94 this->TexturePoints->SetPoint(2, o[0] + imageSize[0], o[1] + imageSize[1], 0.0);
95 this->TexturePoints->SetPoint(3, o[0], o[1] + imageSize[1], 0.0);
100 o[0] = size[0] - o[0];
101 this->TexturePoints->SetPoint(0, o[0] - imageSize[0], o[1], 0.0);
102 this->TexturePoints->SetPoint(1, o[0], o[1], 0.0);
103 this->TexturePoints->SetPoint(2, o[0], o[1] + imageSize[1], 0.0);
104 this->TexturePoints->SetPoint(3, o[0] - imageSize[0], o[1] + imageSize[1], 0.0);
109 o[0] = size[0] - o[0];
110 o[1] = size[1] - o[1];
111 this->TexturePoints->SetPoint(0, o[0] - imageSize[0], o[1] - imageSize[1], 0.0);
112 this->TexturePoints->SetPoint(1, o[0], o[1] - imageSize[1], 0.0);
113 this->TexturePoints->SetPoint(2, o[0], o[1], 0.0);
114 this->TexturePoints->SetPoint(3, o[0] - imageSize[0], o[1], 0.0);
119 o[1] = size[1] - o[1];
120 this->TexturePoints->SetPoint(0, o[0], o[1] - imageSize[1], 0.0);
121 this->TexturePoints->SetPoint(1, o[0] + imageSize[0], o[1] - imageSize[1], 0.0);
122 this->TexturePoints->SetPoint(2, o[0] + imageSize[0], o[1], 0.0);
123 this->TexturePoints->SetPoint(3, o[0], o[1], 0.0);
130 ish[0] = imageSize[0] / 2.0;
131 ish[1] = imageSize[1] / 2.0;
133 o[0] = (size[0]) / 2.0;
134 o[1] = (size[1]) / 2.0;
135 this->TexturePoints->SetPoint(0, o[0] - ish[0], o[1] - ish[1], 0.0);
136 this->TexturePoints->SetPoint(1, o[0] + ish[0], o[1] - ish[1], 0.0);
137 this->TexturePoints->SetPoint(2, o[0] + ish[0], o[1] + ish[1], 0.0);
138 this->TexturePoints->SetPoint(3, o[0] - ish[0], o[1] + ish[1], 0.0);
143 this->TexturePoints->SetPoint(0, o[0], o[1], 0.0);
144 this->TexturePoints->SetPoint(1, o[0] + imageSize[0], o[1], 0.0);
145 this->TexturePoints->SetPoint(2, o[0] + imageSize[0], o[1] + imageSize[1], 0.0);
146 this->TexturePoints->SetPoint(3, o[0], o[1] + imageSize[1], 0.0);
151 this->TexturePoints->Modified();
165 this->Superclass::PrintSelf(os, indent);
169 os << indent <<
"Image:\n";
170 this->
Image->PrintSelf(os, indent.GetNextIndent());
174 os << indent <<
"Image: (none)\n";
177 if (this->ImageProperty)
179 os << indent <<
"Image Property:\n";
180 this->ImageProperty->PrintSelf(os, indent.GetNextIndent());
184 os << indent <<
"Image Property: (none)\n";
void PrintSelf(ostream &os, vtkIndent indent) override
void BuildRepresentation() override
~mitkVtkLogoRepresentation() override
mitkVtkLogoRepresentation()
void AdjustImageSize(double o[2], double borderSize[2], double imageSize[2]) override
vtkStandardNewMacro(mitkVtkLogoRepresentation)