1 #include "vvLandmarksGlyph.h"
3 #include "vtkCellArray.h"
4 #include "vtkInformation.h"
5 #include "vtkInformationVector.h"
6 #include "vtkObjectFactory.h"
7 #include "vtkPointData.h"
9 #include "vtkPolyData.h"
10 #include "vtkUnsignedCharArray.h"
13 vtkCxxRevisionMacro(vvLandmarksGlyph, "DummyRevision");
14 vtkStandardNewMacro(vvLandmarksGlyph);
16 #define vtkfont_width 9
17 //#define vtkfont_width 14
18 #define vtkfont_row_width 864
19 #define vtkfont_height 15
20 //#define vtkfont_height 20
21 static unsigned char vtkfont_bits[] = {
22 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
23 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
24 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
25 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
26 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
27 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
28 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
29 0x00,0x00,0xe0,0x00,0x10,0x90,0x00,0x00,0x40,0x88,0x03,0x1c,0x10,0x08,0x00,
30 0x00,0x00,0x00,0x00,0x00,0x20,0x1c,0x10,0xf8,0xf8,0x03,0xe2,0x0f,0x8f,0x3f,
31 0x3e,0x7c,0x00,0x00,0x00,0x02,0x80,0x00,0x1f,0x3e,0x10,0xfc,0xf0,0xf1,0xe3,
32 0xcf,0x1f,0x1f,0x41,0x7c,0xe0,0x09,0x12,0x20,0x48,0x10,0x1f,0x3f,0x7c,0xfc,
33 0xf0,0xf1,0x27,0x48,0x90,0x20,0x41,0x82,0xfc,0xe1,0x11,0xc0,0x03,0x02,0x00,
34 0x0e,0x00,0x04,0x00,0x00,0x04,0x00,0x0e,0x00,0x01,0x00,0x00,0x08,0xc0,0x00,
35 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
36 0x80,0x83,0xe0,0x80,0x11,0xe0,0x00,0x10,0x90,0x90,0x80,0xa0,0x44,0x04,0x0c,
37 0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x22,0x18,0x04,0x01,0x02,0x23,
38 0x80,0x00,0x20,0x41,0x82,0x00,0x00,0x00,0x01,0x00,0x81,0x20,0x41,0x28,0x08,
39 0x09,0x22,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x08,0x11,0x20,0x48,0x90,0x20,
40 0x41,0x82,0x04,0x09,0x82,0x20,0x48,0x90,0x20,0x41,0x82,0x00,0x21,0x20,0x00,
41 0x02,0x05,0x00,0x0c,0x00,0x04,0x00,0x00,0x04,0x00,0x11,0x00,0x01,0x10,0x80,
42 0x08,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,
43 0x00,0x00,0x00,0x40,0x80,0x00,0x41,0x12,0xe0,0x00,0x10,0x90,0x90,0xe0,0xa3,
44 0x44,0x04,0x02,0x08,0x10,0x00,0x40,0x00,0x00,0x00,0x00,0x10,0x41,0x14,0x04,
45 0x01,0x81,0x22,0x40,0x00,0x20,0x41,0x82,0x00,0x00,0x80,0x00,0x00,0x82,0x20,
46 0x41,0x44,0x08,0x09,0x20,0x44,0x80,0x80,0x00,0x41,0x10,0x80,0x88,0x10,0x60,
47 0xcc,0x90,0x20,0x41,0x82,0x04,0x09,0x80,0x20,0x48,0x90,0x20,0x22,0x44,0x80,
48 0x20,0x20,0x00,0x82,0x08,0x00,0x10,0x00,0x04,0x00,0x00,0x04,0x00,0x11,0x00,
49 0x01,0x00,0x00,0x08,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
50 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00,0x41,0x0c,0xe0,0x00,0x10,0x00,
51 0xf8,0x91,0x40,0x42,0x04,0x00,0x04,0x20,0x88,0x40,0x00,0x00,0x00,0x00,0x08,
52 0x41,0x10,0x00,0x81,0x40,0xa2,0x47,0x00,0x10,0x41,0x82,0x20,0x40,0x40,0x00,
53 0x00,0x04,0x20,0x79,0x82,0x08,0x09,0x20,0x44,0x80,0x80,0x00,0x41,0x10,0x80,
54 0x48,0x10,0xa0,0x4a,0x91,0x20,0x41,0x82,0x04,0x09,0x80,0x20,0x88,0x88,0x20,
55 0x14,0x28,0x40,0x20,0x40,0x00,0x42,0x10,0x00,0x00,0x7c,0xf4,0xf0,0xe1,0xc5,
56 0x07,0x01,0x2f,0x3d,0x18,0xe0,0x08,0x82,0xe0,0x46,0x0f,0x1f,0x3d,0xbc,0xe4,
57 0xf0,0xf1,0x23,0x44,0x90,0x20,0x41,0x42,0xfc,0x81,0x80,0x80,0x00,0x00,0xe0,
58 0x00,0x10,0x00,0x90,0x90,0x00,0x81,0x03,0x00,0x04,0x20,0x50,0x40,0x00,0x00,
59 0x00,0x00,0x04,0x41,0x10,0x80,0xc0,0x21,0x62,0x48,0x0f,0x08,0x3e,0xc2,0x70,
60 0xe0,0x20,0xe0,0x0f,0x08,0x10,0x45,0x82,0xf8,0x08,0x20,0xc4,0x83,0x87,0x00,
61 0x7f,0x10,0x80,0x38,0x10,0xa0,0x4a,0x92,0x20,0x3f,0x82,0xfc,0xf0,0x81,0x20,
62 0x88,0x88,0x24,0x08,0x10,0x20,0x20,0x80,0x00,0x02,0x00,0x00,0x00,0x80,0x0c,
63 0x09,0x12,0x26,0x08,0x81,0x10,0x43,0x10,0x80,0x88,0x81,0x20,0xc9,0x90,0x20,
64 0x43,0xc2,0x18,0x09,0x42,0x20,0x44,0x90,0x20,0x22,0x42,0x80,0x60,0x80,0x00,
65 0x03,0x00,0xe0,0x00,0x10,0x00,0x90,0xe0,0x03,0x41,0x04,0x00,0x04,0x20,0xfc,
66 0xf9,0x03,0xe0,0x0f,0x00,0x04,0x41,0x10,0x40,0x00,0x12,0x02,0xc8,0x10,0x04,
67 0x41,0xbc,0x20,0x40,0x20,0x00,0x00,0x08,0x08,0x65,0x82,0x08,0x09,0x20,0x44,
68 0x80,0x80,0x38,0x41,0x10,0x80,0x28,0x10,0x20,0x49,0x94,0x20,0x01,0x82,0x24,
69 0x00,0x82,0x20,0x88,0x88,0x24,0x08,0x10,0x10,0x20,0x80,0x00,0x02,0x00,0x00,
70 0x00,0x80,0x04,0x09,0x10,0x24,0xc8,0x87,0x10,0x41,0x10,0x80,0x68,0x80,0x20,
71 0x49,0x90,0x20,0x41,0x82,0x08,0x09,0x40,0x20,0x84,0x88,0x24,0x14,0x42,0x40,
72 0x60,0x80,0x00,0x03,0x00,0xe0,0x00,0x10,0x00,0xf8,0x81,0x84,0x44,0x14,0x00,
73 0x04,0x20,0x50,0x40,0x00,0x00,0x00,0x00,0x02,0x41,0x10,0x30,0x00,0xf2,0x07,
74 0x48,0x10,0x02,0x41,0x80,0x00,0x00,0x40,0x00,0x00,0x04,0x04,0x59,0xfe,0x08,
75 0x09,0x20,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x48,0x10,0x20,0x49,0x98,0x20,
76 0x01,0x82,0x44,0x00,0x82,0x20,0x08,0x85,0x24,0x14,0x10,0x08,0x20,0x00,0x01,
77 0x02,0x00,0x00,0x00,0xfc,0x04,0x09,0x10,0xe4,0x0f,0x81,0x10,0x41,0x10,0x80,
78 0x18,0x80,0x20,0x49,0x90,0x20,0x41,0x82,0x08,0xf0,0x41,0x20,0x84,0x88,0x24,
79 0x08,0x42,0x20,0x80,0x80,0x80,0x00,0x00,0xe0,0x00,0x10,0x00,0x90,0x80,0x44,
80 0x4a,0x08,0x00,0x08,0x10,0x88,0x40,0x00,0x00,0x00,0x00,0x01,0x41,0x10,0x08,
81 0x00,0x02,0x02,0x48,0x10,0x02,0x41,0x80,0x00,0x00,0x80,0xe0,0x0f,0x02,0x04,
82 0x01,0x82,0x08,0x09,0x20,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x88,0x10,0x20,
83 0x48,0x90,0x20,0x01,0x92,0x84,0x00,0x82,0x20,0x08,0x85,0x24,0x22,0x10,0x04,
84 0x20,0x00,0x02,0x02,0x00,0x00,0x00,0x82,0x04,0x09,0x10,0x24,0x00,0x01,0x0f,
85 0x41,0x10,0x80,0x68,0x80,0x20,0x49,0x90,0x20,0x41,0x82,0x08,0x00,0x42,0x20,
86 0x04,0x85,0x24,0x14,0x42,0x10,0x40,0x80,0x00,0x01,0x00,0xe0,0x00,0x00,0x00,
87 0x90,0xe0,0x43,0x4a,0x0c,0x00,0x08,0x10,0x00,0x40,0xc0,0x01,0x00,0x02,0x01,
88 0x22,0x10,0x04,0x08,0x02,0x22,0x48,0x10,0x01,0x41,0x40,0x20,0xe0,0x00,0x01,
89 0x00,0x01,0x00,0x01,0x82,0x08,0x09,0x22,0x44,0x80,0x80,0x20,0x41,0x10,0x84,
90 0x08,0x11,0x20,0x48,0x90,0x20,0x01,0xa2,0x04,0x09,0x82,0x20,0x08,0x85,0x2a,
91 0x41,0x10,0x04,0x20,0x00,0x02,0x02,0x00,0x00,0x00,0xc2,0x0c,0x09,0x12,0x26,
92 0x00,0x81,0x00,0x41,0x10,0x80,0x88,0x81,0x20,0x49,0x90,0x20,0x43,0xc2,0x08,
93 0x08,0x42,0x24,0x04,0x85,0x2a,0x22,0x62,0x08,0x40,0x80,0x00,0x01,0x00,0xe0,
94 0x00,0x10,0x00,0x00,0x80,0x20,0x84,0x13,0x00,0x10,0x08,0x00,0x00,0xc0,0x00,
95 0x00,0x87,0x00,0x1c,0x7c,0xfc,0xf1,0x01,0xc2,0x87,0x0f,0x01,0x3e,0x3c,0x70,
96 0x60,0x00,0x02,0x80,0x00,0x04,0x3e,0x82,0xfc,0xf0,0xf1,0xe3,0x8f,0x00,0x1f,
97 0x41,0x7c,0x78,0x08,0xf2,0x27,0x48,0x10,0x1f,0x01,0x7c,0x04,0xf1,0x81,0xc0,
98 0x07,0x02,0x11,0x41,0x10,0xfc,0xe1,0x01,0xc4,0x03,0x00,0x00,0x00,0xbc,0xf4,
99 0xf0,0xe1,0xc5,0x07,0x01,0x1f,0x41,0x7c,0x84,0x08,0xe2,0x23,0x48,0x10,0x1f,
100 0x3d,0xbc,0x08,0xf0,0x81,0xc3,0x0b,0x02,0x11,0x41,0x5c,0xfc,0x81,0x83,0xe0,
101 0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
102 0x00,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
103 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
104 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
105 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x3f,
106 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x00,0x00,0x84,0x00,0x00,0x00,
107 0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
108 0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
109 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
110 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
111 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
112 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
113 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x00,0x00,0x84,
114 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
115 0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,
116 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
117 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
118 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
119 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
120 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,
121 0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,
122 0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,
123 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
124 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
125 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
126 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
127 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
128 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
129 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0
132 // Construct object with no string set and backing enabled.
133 vvLandmarksGlyph::vvLandmarksGlyph()
137 this->ForegroundColor[0] = 1.0;
138 this->ForegroundColor[1] = 1.0;
139 this->ForegroundColor[2] = 1.0;
140 this->ForegroundColor[3] = 1.0;
141 this->BackgroundColor[0] = 0.0;
142 this->BackgroundColor[1] = 0.0;
143 this->BackgroundColor[2] = 0.0;
144 this->BackgroundColor[3] = 1.0;
146 this->SetNumberOfInputPorts(0);
149 vvLandmarksGlyph::~vvLandmarksGlyph()
153 delete [] this->Text;
157 int vvLandmarksGlyph::RequestData(
158 vtkInformation *vtkNotUsed(request),
159 vtkInformationVector **vtkNotUsed(inputVector),
160 vtkInformationVector *outputVector)
162 // get the info object
163 vtkInformation *outInfo = outputVector->GetInformationObject(0);
166 vtkPolyData *output = vtkPolyData::SafeDownCast(
167 outInfo->Get(vtkDataObject::DATA_OBJECT()));
169 vtkPoints *newPoints;
170 vtkCellArray *newPolys;
171 vtkCellArray *newLines;
172 vtkUnsignedCharArray *newScalars;
174 newPoints = vtkPoints::New();
175 newPolys = vtkCellArray::New();
176 newScalars = vtkUnsignedCharArray::New();
177 newScalars->SetNumberOfComponents(4);
178 newLines = vtkCellArray::New();
179 newLines->Allocate(newLines->EstimateSize(3,2));
181 AddTextGlyph(newPoints,newScalars,newPolys,0);
182 AddTextGlyph(newPoints,newScalars,newPolys,1);
183 AddTextGlyph(newPoints,newScalars,newPolys,2);
185 AddCrossGlyph(newPoints, newLines);
187 output->SetPoints(newPoints);
190 output->SetLines(newLines);
193 output->GetPointData()->SetScalars(newScalars);
194 newScalars->Delete();
196 output->SetPolys(newPolys);
202 void vvLandmarksGlyph::AddTextGlyph(vtkPoints* newPoints,vtkUnsignedCharArray* newScalars, vtkCellArray *newPolys, int orientation)
208 vtkIdType numPolys = 0;
211 int drawingWhite = 0;
212 int drawingBlack = 0;
213 unsigned char white[4];
214 unsigned char black[4];
215 std::cout << "AddTextGlyph(output," << orientation << ")" << std::endl;
217 if (this->Text == NULL)
219 vtkErrorMacro (<< "Text is not set!");
223 // convert colors to unsigned char
224 for (int i = 0; i < 4; i++)
226 white[i] = (unsigned char) (this->ForegroundColor[i] * 255.0);
227 black[i] = (unsigned char) (this->BackgroundColor[i] * 255.0);
230 std::cout << "Create Text" << std::endl;
232 while (this->Text[pos])
234 if (this->Text[pos] != 32)
236 for (col = 0; col < vtkfont_width; col++)
238 acol = (this->Text[pos] - 32)*vtkfont_width + col - 1;
239 for (row = 0; row < vtkfont_height; row++)
241 pixelPos = acol + row*vtkfont_row_width;
242 if (vtkfont_bits[pixelPos/8] & (0x01 << pixelPos%8))
246 x[0] = pos*vtkfont_width + col + 1;
247 x[1] = vtkfont_height - row;
249 ChangeOrientation(x,orientation);
250 newPoints->InsertNextPoint(x);
251 newScalars->InsertNextValue(black[0]);
252 newScalars->InsertNextValue(black[1]);
253 newScalars->InsertNextValue(black[2]);
254 newScalars->InsertNextValue(black[3]);
256 x[0] = pos*vtkfont_width + col;
257 x[1] = vtkfont_height - row;
259 ChangeOrientation(x,orientation);
260 newPoints->InsertNextPoint(x);
261 newScalars->InsertNextValue(black[0]);
262 newScalars->InsertNextValue(black[1]);
263 newScalars->InsertNextValue(black[2]);
264 newScalars->InsertNextValue(black[3]);
267 pts[1] = numPolys*4 + 1;
268 pts[2] = numPolys*4 + 2;
269 pts[3] = numPolys*4 + 3;
270 newPolys->InsertNextCell(4,pts);
276 x[0] = pos*vtkfont_width + col;
277 x[1] = vtkfont_height - row;
279 ChangeOrientation(x,orientation);
280 newPoints->InsertNextPoint(x);
281 newScalars->InsertNextValue(white[0]);
282 newScalars->InsertNextValue(white[1]);
283 newScalars->InsertNextValue(white[2]);
284 newScalars->InsertNextValue(white[3]);
286 x[0] = pos*vtkfont_width + col + 1;
287 x[1] = vtkfont_height - row;
289 ChangeOrientation(x,orientation);
290 newPoints->InsertNextPoint(x);
291 newScalars->InsertNextValue(white[0]);
292 newScalars->InsertNextValue(white[1]);
293 newScalars->InsertNextValue(white[2]);
294 newScalars->InsertNextValue(white[3]);
298 // if the pixel is not set the close up the rectangle
303 x[0] = pos*vtkfont_width + col + 1;
304 x[1] = vtkfont_height - row;
306 ChangeOrientation(x,orientation);
307 newPoints->InsertNextPoint(x);
308 newScalars->InsertNextValue(white[0]);
309 newScalars->InsertNextValue(white[1]);
310 newScalars->InsertNextValue(white[2]);
311 newScalars->InsertNextValue(white[3]);
313 x[0] = pos*vtkfont_width + col;
314 x[1] = vtkfont_height - row;
316 ChangeOrientation(x,orientation);
317 newPoints->InsertNextPoint(x);
318 newScalars->InsertNextValue(white[0]);
319 newScalars->InsertNextValue(white[1]);
320 newScalars->InsertNextValue(white[2]);
321 newScalars->InsertNextValue(white[3]);
324 pts[1] = numPolys*4 + 1;
325 pts[2] = numPolys*4 + 2;
326 pts[3] = numPolys*4 + 3;
327 newPolys->InsertNextCell(4,pts);
331 if (!drawingBlack && this->Backing)
333 x[0] = pos*vtkfont_width + col;
334 x[1] = vtkfont_height - row;
336 ChangeOrientation(x,orientation);
337 newPoints->InsertNextPoint(x);
338 newScalars->InsertNextValue(black[0]);
339 newScalars->InsertNextValue(black[1]);
340 newScalars->InsertNextValue(black[2]);
341 newScalars->InsertNextValue(black[3]);
343 x[0] = pos*vtkfont_width + col + 1;
344 x[1] = vtkfont_height - row;
346 ChangeOrientation(x,orientation);
347 newPoints->InsertNextPoint(x);
348 newScalars->InsertNextValue(black[0]);
349 newScalars->InsertNextValue(black[1]);
350 newScalars->InsertNextValue(black[2]);
351 newScalars->InsertNextValue(black[3]);
356 // if we finished up a row but are still drawing close it up
359 x[0] = pos*vtkfont_width + col + 1;
362 ChangeOrientation(x,orientation);
363 newPoints->InsertNextPoint(x);
364 newScalars->InsertNextValue(white[0]);
365 newScalars->InsertNextValue(white[1]);
366 newScalars->InsertNextValue(white[2]);
367 newScalars->InsertNextValue(white[3]);
369 x[0] = pos*vtkfont_width + col;
372 ChangeOrientation(x,orientation);
373 newPoints->InsertNextPoint(x);
374 newScalars->InsertNextValue(white[0]);
375 newScalars->InsertNextValue(white[1]);
376 newScalars->InsertNextValue(white[2]);
377 newScalars->InsertNextValue(white[3]);
380 pts[1] = numPolys*4 + 1;
381 pts[2] = numPolys*4 + 2;
382 pts[3] = numPolys*4 + 3;
383 newPolys->InsertNextCell(4,pts);
389 x[0] = pos*vtkfont_width + col + 1;
392 ChangeOrientation(x,orientation);
393 newPoints->InsertNextPoint(x);
394 newScalars->InsertNextValue(black[0]);
395 newScalars->InsertNextValue(black[1]);
396 newScalars->InsertNextValue(black[2]);
397 newScalars->InsertNextValue(black[3]);
399 x[0] = pos*vtkfont_width + col;
402 ChangeOrientation(x,orientation);
403 newPoints->InsertNextPoint(x);
404 newScalars->InsertNextValue(black[0]);
405 newScalars->InsertNextValue(black[1]);
406 newScalars->InsertNextValue(black[2]);
407 newScalars->InsertNextValue(black[3]);
410 pts[1] = numPolys*4 + 1;
411 pts[2] = numPolys*4 + 2;
412 pts[3] = numPolys*4 + 3;
413 newPolys->InsertNextCell(4,pts);
421 // draw a black square for a space
424 x[0] = pos*vtkfont_width;
425 x[1] = vtkfont_height;
427 ChangeOrientation(x,orientation);
428 newPoints->InsertNextPoint(x);
429 newScalars->InsertNextValue(black[0]);
430 newScalars->InsertNextValue(black[1]);
431 newScalars->InsertNextValue(black[2]);
432 newScalars->InsertNextValue(black[3]);
434 x[0] = pos*vtkfont_width + vtkfont_width;
435 x[1] = vtkfont_height;
437 ChangeOrientation(x,orientation);
438 newPoints->InsertNextPoint(x);
439 newScalars->InsertNextValue(black[0]);
440 newScalars->InsertNextValue(black[1]);
441 newScalars->InsertNextValue(black[2]);
442 newScalars->InsertNextValue(black[3]);
444 x[0] = pos*vtkfont_width + vtkfont_width;
447 ChangeOrientation(x,orientation);
448 newPoints->InsertNextPoint(x);
449 newScalars->InsertNextValue(black[0]);
450 newScalars->InsertNextValue(black[1]);
451 newScalars->InsertNextValue(black[2]);
452 newScalars->InsertNextValue(black[3]);
454 x[0] = pos*vtkfont_width;
457 ChangeOrientation(x,orientation);
458 newPoints->InsertNextPoint(x);
459 newScalars->InsertNextValue(black[0]);
460 newScalars->InsertNextValue(black[1]);
461 newScalars->InsertNextValue(black[2]);
462 newScalars->InsertNextValue(black[3]);
465 pts[1] = numPolys*4 + 1;
466 pts[2] = numPolys*4 + 2;
467 pts[3] = numPolys*4 + 3;
468 newPolys->InsertNextCell(4,pts);
476 void vvLandmarksGlyph::AddCrossGlyph(vtkPoints* newPts,vtkCellArray* newLines)
480 std::cout << "AddCross" << std::endl;
484 ptIds[0] = newPts->InsertNextPoint(x);
489 ptIds[1] = newPts->InsertNextPoint(x);
490 newLines->InsertNextCell(2,ptIds);
495 ptIds[0] = newPts->InsertNextPoint(x);
500 ptIds[1] = newPts->InsertNextPoint(x);
501 newLines->InsertNextCell(2,ptIds);
506 ptIds[0] = newPts->InsertNextPoint(x);
511 ptIds[1] = newPts->InsertNextPoint(x);
512 newLines->InsertNextCell(2,ptIds);
516 void vvLandmarksGlyph::ChangeOrientation(double v[3],int orientation)
537 assert(false); //This definitely shouldn't happen
544 void vvLandmarksGlyph::PrintSelf(ostream& os, vtkIndent indent)
546 this->Superclass::PrintSelf(os,indent);
548 os << indent << "Text: " << (this->Text ? this->Text : "(none)") << "\n";
549 os << indent << "Background Drawn: " << (this->Backing ? "On\n" : "Off\n");
550 os << indent << "ForegroundColor: (" << this->ForegroundColor[0] << ", "
551 << this->ForegroundColor[1] << ", " << this->ForegroundColor[2] << ")\n";
552 os << indent << "BackgroundColor: (" << this->BackgroundColor[0] << ", "
553 << this->BackgroundColor[1] << ", " << this->BackgroundColor[2] << ")\n";