1 /*=========================================================================
3 Program: Visualization Toolkit
5 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
13 =========================================================================*/
14 #include "vvLandmarksGlyph.h"
16 #include "vtkCellArray.h"
17 #include "vtkInformation.h"
18 #include "vtkInformationVector.h"
19 #include "vtkObjectFactory.h"
20 #include "vtkPointData.h"
21 #include "vtkPoints.h"
22 #include "vtkPolyData.h"
23 #include "vtkUnsignedCharArray.h"
26 vtkCxxRevisionMacro(vvLandmarksGlyph, "DummyRevision");
27 vtkStandardNewMacro(vvLandmarksGlyph);
29 #define vtkfont_width 9
30 //#define vtkfont_width 14
31 #define vtkfont_row_width 864
32 #define vtkfont_height 15
33 //#define vtkfont_height 20
34 static unsigned char vtkfont_bits[] = {
35 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
36 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
37 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
38 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
39 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
40 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
41 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
42 0x00,0x00,0xe0,0x00,0x10,0x90,0x00,0x00,0x40,0x88,0x03,0x1c,0x10,0x08,0x00,
43 0x00,0x00,0x00,0x00,0x00,0x20,0x1c,0x10,0xf8,0xf8,0x03,0xe2,0x0f,0x8f,0x3f,
44 0x3e,0x7c,0x00,0x00,0x00,0x02,0x80,0x00,0x1f,0x3e,0x10,0xfc,0xf0,0xf1,0xe3,
45 0xcf,0x1f,0x1f,0x41,0x7c,0xe0,0x09,0x12,0x20,0x48,0x10,0x1f,0x3f,0x7c,0xfc,
46 0xf0,0xf1,0x27,0x48,0x90,0x20,0x41,0x82,0xfc,0xe1,0x11,0xc0,0x03,0x02,0x00,
47 0x0e,0x00,0x04,0x00,0x00,0x04,0x00,0x0e,0x00,0x01,0x00,0x00,0x08,0xc0,0x00,
48 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
49 0x80,0x83,0xe0,0x80,0x11,0xe0,0x00,0x10,0x90,0x90,0x80,0xa0,0x44,0x04,0x0c,
50 0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x22,0x18,0x04,0x01,0x02,0x23,
51 0x80,0x00,0x20,0x41,0x82,0x00,0x00,0x00,0x01,0x00,0x81,0x20,0x41,0x28,0x08,
52 0x09,0x22,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x08,0x11,0x20,0x48,0x90,0x20,
53 0x41,0x82,0x04,0x09,0x82,0x20,0x48,0x90,0x20,0x41,0x82,0x00,0x21,0x20,0x00,
54 0x02,0x05,0x00,0x0c,0x00,0x04,0x00,0x00,0x04,0x00,0x11,0x00,0x01,0x10,0x80,
55 0x08,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,
56 0x00,0x00,0x00,0x40,0x80,0x00,0x41,0x12,0xe0,0x00,0x10,0x90,0x90,0xe0,0xa3,
57 0x44,0x04,0x02,0x08,0x10,0x00,0x40,0x00,0x00,0x00,0x00,0x10,0x41,0x14,0x04,
58 0x01,0x81,0x22,0x40,0x00,0x20,0x41,0x82,0x00,0x00,0x80,0x00,0x00,0x82,0x20,
59 0x41,0x44,0x08,0x09,0x20,0x44,0x80,0x80,0x00,0x41,0x10,0x80,0x88,0x10,0x60,
60 0xcc,0x90,0x20,0x41,0x82,0x04,0x09,0x80,0x20,0x48,0x90,0x20,0x22,0x44,0x80,
61 0x20,0x20,0x00,0x82,0x08,0x00,0x10,0x00,0x04,0x00,0x00,0x04,0x00,0x11,0x00,
62 0x01,0x00,0x00,0x08,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
63 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00,0x41,0x0c,0xe0,0x00,0x10,0x00,
64 0xf8,0x91,0x40,0x42,0x04,0x00,0x04,0x20,0x88,0x40,0x00,0x00,0x00,0x00,0x08,
65 0x41,0x10,0x00,0x81,0x40,0xa2,0x47,0x00,0x10,0x41,0x82,0x20,0x40,0x40,0x00,
66 0x00,0x04,0x20,0x79,0x82,0x08,0x09,0x20,0x44,0x80,0x80,0x00,0x41,0x10,0x80,
67 0x48,0x10,0xa0,0x4a,0x91,0x20,0x41,0x82,0x04,0x09,0x80,0x20,0x88,0x88,0x20,
68 0x14,0x28,0x40,0x20,0x40,0x00,0x42,0x10,0x00,0x00,0x7c,0xf4,0xf0,0xe1,0xc5,
69 0x07,0x01,0x2f,0x3d,0x18,0xe0,0x08,0x82,0xe0,0x46,0x0f,0x1f,0x3d,0xbc,0xe4,
70 0xf0,0xf1,0x23,0x44,0x90,0x20,0x41,0x42,0xfc,0x81,0x80,0x80,0x00,0x00,0xe0,
71 0x00,0x10,0x00,0x90,0x90,0x00,0x81,0x03,0x00,0x04,0x20,0x50,0x40,0x00,0x00,
72 0x00,0x00,0x04,0x41,0x10,0x80,0xc0,0x21,0x62,0x48,0x0f,0x08,0x3e,0xc2,0x70,
73 0xe0,0x20,0xe0,0x0f,0x08,0x10,0x45,0x82,0xf8,0x08,0x20,0xc4,0x83,0x87,0x00,
74 0x7f,0x10,0x80,0x38,0x10,0xa0,0x4a,0x92,0x20,0x3f,0x82,0xfc,0xf0,0x81,0x20,
75 0x88,0x88,0x24,0x08,0x10,0x20,0x20,0x80,0x00,0x02,0x00,0x00,0x00,0x80,0x0c,
76 0x09,0x12,0x26,0x08,0x81,0x10,0x43,0x10,0x80,0x88,0x81,0x20,0xc9,0x90,0x20,
77 0x43,0xc2,0x18,0x09,0x42,0x20,0x44,0x90,0x20,0x22,0x42,0x80,0x60,0x80,0x00,
78 0x03,0x00,0xe0,0x00,0x10,0x00,0x90,0xe0,0x03,0x41,0x04,0x00,0x04,0x20,0xfc,
79 0xf9,0x03,0xe0,0x0f,0x00,0x04,0x41,0x10,0x40,0x00,0x12,0x02,0xc8,0x10,0x04,
80 0x41,0xbc,0x20,0x40,0x20,0x00,0x00,0x08,0x08,0x65,0x82,0x08,0x09,0x20,0x44,
81 0x80,0x80,0x38,0x41,0x10,0x80,0x28,0x10,0x20,0x49,0x94,0x20,0x01,0x82,0x24,
82 0x00,0x82,0x20,0x88,0x88,0x24,0x08,0x10,0x10,0x20,0x80,0x00,0x02,0x00,0x00,
83 0x00,0x80,0x04,0x09,0x10,0x24,0xc8,0x87,0x10,0x41,0x10,0x80,0x68,0x80,0x20,
84 0x49,0x90,0x20,0x41,0x82,0x08,0x09,0x40,0x20,0x84,0x88,0x24,0x14,0x42,0x40,
85 0x60,0x80,0x00,0x03,0x00,0xe0,0x00,0x10,0x00,0xf8,0x81,0x84,0x44,0x14,0x00,
86 0x04,0x20,0x50,0x40,0x00,0x00,0x00,0x00,0x02,0x41,0x10,0x30,0x00,0xf2,0x07,
87 0x48,0x10,0x02,0x41,0x80,0x00,0x00,0x40,0x00,0x00,0x04,0x04,0x59,0xfe,0x08,
88 0x09,0x20,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x48,0x10,0x20,0x49,0x98,0x20,
89 0x01,0x82,0x44,0x00,0x82,0x20,0x08,0x85,0x24,0x14,0x10,0x08,0x20,0x00,0x01,
90 0x02,0x00,0x00,0x00,0xfc,0x04,0x09,0x10,0xe4,0x0f,0x81,0x10,0x41,0x10,0x80,
91 0x18,0x80,0x20,0x49,0x90,0x20,0x41,0x82,0x08,0xf0,0x41,0x20,0x84,0x88,0x24,
92 0x08,0x42,0x20,0x80,0x80,0x80,0x00,0x00,0xe0,0x00,0x10,0x00,0x90,0x80,0x44,
93 0x4a,0x08,0x00,0x08,0x10,0x88,0x40,0x00,0x00,0x00,0x00,0x01,0x41,0x10,0x08,
94 0x00,0x02,0x02,0x48,0x10,0x02,0x41,0x80,0x00,0x00,0x80,0xe0,0x0f,0x02,0x04,
95 0x01,0x82,0x08,0x09,0x20,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x88,0x10,0x20,
96 0x48,0x90,0x20,0x01,0x92,0x84,0x00,0x82,0x20,0x08,0x85,0x24,0x22,0x10,0x04,
97 0x20,0x00,0x02,0x02,0x00,0x00,0x00,0x82,0x04,0x09,0x10,0x24,0x00,0x01,0x0f,
98 0x41,0x10,0x80,0x68,0x80,0x20,0x49,0x90,0x20,0x41,0x82,0x08,0x00,0x42,0x20,
99 0x04,0x85,0x24,0x14,0x42,0x10,0x40,0x80,0x00,0x01,0x00,0xe0,0x00,0x00,0x00,
100 0x90,0xe0,0x43,0x4a,0x0c,0x00,0x08,0x10,0x00,0x40,0xc0,0x01,0x00,0x02,0x01,
101 0x22,0x10,0x04,0x08,0x02,0x22,0x48,0x10,0x01,0x41,0x40,0x20,0xe0,0x00,0x01,
102 0x00,0x01,0x00,0x01,0x82,0x08,0x09,0x22,0x44,0x80,0x80,0x20,0x41,0x10,0x84,
103 0x08,0x11,0x20,0x48,0x90,0x20,0x01,0xa2,0x04,0x09,0x82,0x20,0x08,0x85,0x2a,
104 0x41,0x10,0x04,0x20,0x00,0x02,0x02,0x00,0x00,0x00,0xc2,0x0c,0x09,0x12,0x26,
105 0x00,0x81,0x00,0x41,0x10,0x80,0x88,0x81,0x20,0x49,0x90,0x20,0x43,0xc2,0x08,
106 0x08,0x42,0x24,0x04,0x85,0x2a,0x22,0x62,0x08,0x40,0x80,0x00,0x01,0x00,0xe0,
107 0x00,0x10,0x00,0x00,0x80,0x20,0x84,0x13,0x00,0x10,0x08,0x00,0x00,0xc0,0x00,
108 0x00,0x87,0x00,0x1c,0x7c,0xfc,0xf1,0x01,0xc2,0x87,0x0f,0x01,0x3e,0x3c,0x70,
109 0x60,0x00,0x02,0x80,0x00,0x04,0x3e,0x82,0xfc,0xf0,0xf1,0xe3,0x8f,0x00,0x1f,
110 0x41,0x7c,0x78,0x08,0xf2,0x27,0x48,0x10,0x1f,0x01,0x7c,0x04,0xf1,0x81,0xc0,
111 0x07,0x02,0x11,0x41,0x10,0xfc,0xe1,0x01,0xc4,0x03,0x00,0x00,0x00,0xbc,0xf4,
112 0xf0,0xe1,0xc5,0x07,0x01,0x1f,0x41,0x7c,0x84,0x08,0xe2,0x23,0x48,0x10,0x1f,
113 0x3d,0xbc,0x08,0xf0,0x81,0xc3,0x0b,0x02,0x11,0x41,0x5c,0xfc,0x81,0x83,0xe0,
114 0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
115 0x00,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
116 0x00,0x00,0x20,0x10,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,0x80,0x00,
118 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x3f,
119 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x00,0x00,0x84,0x00,0x00,0x00,
120 0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
121 0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
122 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0x80,0x20,0x00,0x00,0x84,
127 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
128 0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,
129 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
130 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
131 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
132 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
133 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,
134 0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,
135 0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,0x00,0x00,
136 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
137 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
138 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
139 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
140 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
141 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
142 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0
145 // Construct object with no string set and backing enabled.
146 vvLandmarksGlyph::vvLandmarksGlyph()
150 this->ForegroundColor[0] = 1.0;
151 this->ForegroundColor[1] = 1.0;
152 this->ForegroundColor[2] = 1.0;
153 this->ForegroundColor[3] = 1.0;
154 this->BackgroundColor[0] = 0.0;
155 this->BackgroundColor[1] = 0.0;
156 this->BackgroundColor[2] = 0.0;
157 this->BackgroundColor[3] = 1.0;
159 this->SetNumberOfInputPorts(0);
162 vvLandmarksGlyph::~vvLandmarksGlyph()
166 delete [] this->Text;
170 int vvLandmarksGlyph::RequestData(
171 vtkInformation *vtkNotUsed(request),
172 vtkInformationVector **vtkNotUsed(inputVector),
173 vtkInformationVector *outputVector)
175 // get the info object
176 vtkInformation *outInfo = outputVector->GetInformationObject(0);
179 vtkPolyData *output = vtkPolyData::SafeDownCast(
180 outInfo->Get(vtkDataObject::DATA_OBJECT()));
182 vtkPoints *newPoints;
183 vtkCellArray *newPolys;
184 vtkCellArray *newLines;
185 vtkUnsignedCharArray *newScalars;
187 newPoints = vtkPoints::New();
188 newPolys = vtkCellArray::New();
189 newScalars = vtkUnsignedCharArray::New();
190 newScalars->SetNumberOfComponents(4);
191 newLines = vtkCellArray::New();
192 newLines->Allocate(newLines->EstimateSize(3,2));
194 AddTextGlyph(newPoints,newScalars,newPolys,0);
195 AddTextGlyph(newPoints,newScalars,newPolys,1);
196 AddTextGlyph(newPoints,newScalars,newPolys,2);
198 AddCrossGlyph(newPoints, newLines);
200 output->SetPoints(newPoints);
203 output->SetLines(newLines);
206 output->GetPointData()->SetScalars(newScalars);
207 newScalars->Delete();
209 output->SetPolys(newPolys);
215 void vvLandmarksGlyph::AddTextGlyph(vtkPoints* newPoints,vtkUnsignedCharArray* newScalars, vtkCellArray *newPolys, int orientation)
221 vtkIdType numPolys = 0;
224 int drawingWhite = 0;
225 int drawingBlack = 0;
226 unsigned char white[4];
227 unsigned char black[4];
228 std::cout << "AddTextGlyph(output," << orientation << ")" << std::endl;
230 if (this->Text == NULL)
232 vtkErrorMacro (<< "Text is not set!");
236 // convert colors to unsigned char
237 for (int i = 0; i < 4; i++)
239 white[i] = (unsigned char) (this->ForegroundColor[i] * 255.0);
240 black[i] = (unsigned char) (this->BackgroundColor[i] * 255.0);
243 std::cout << "Create Text" << std::endl;
245 while (this->Text[pos])
247 if (this->Text[pos] != 32)
249 for (col = 0; col < vtkfont_width; col++)
251 acol = (this->Text[pos] - 32)*vtkfont_width + col - 1;
252 for (row = 0; row < vtkfont_height; row++)
254 pixelPos = acol + row*vtkfont_row_width;
255 if (vtkfont_bits[pixelPos/8] & (0x01 << pixelPos%8))
259 x[0] = pos*vtkfont_width + col + 1;
260 x[1] = vtkfont_height - row;
262 ChangeOrientation(x,orientation);
263 newPoints->InsertNextPoint(x);
264 newScalars->InsertNextValue(black[0]);
265 newScalars->InsertNextValue(black[1]);
266 newScalars->InsertNextValue(black[2]);
267 newScalars->InsertNextValue(black[3]);
269 x[0] = pos*vtkfont_width + col;
270 x[1] = vtkfont_height - row;
272 ChangeOrientation(x,orientation);
273 newPoints->InsertNextPoint(x);
274 newScalars->InsertNextValue(black[0]);
275 newScalars->InsertNextValue(black[1]);
276 newScalars->InsertNextValue(black[2]);
277 newScalars->InsertNextValue(black[3]);
280 pts[1] = numPolys*4 + 1;
281 pts[2] = numPolys*4 + 2;
282 pts[3] = numPolys*4 + 3;
283 newPolys->InsertNextCell(4,pts);
289 x[0] = pos*vtkfont_width + col;
290 x[1] = vtkfont_height - row;
292 ChangeOrientation(x,orientation);
293 newPoints->InsertNextPoint(x);
294 newScalars->InsertNextValue(white[0]);
295 newScalars->InsertNextValue(white[1]);
296 newScalars->InsertNextValue(white[2]);
297 newScalars->InsertNextValue(white[3]);
299 x[0] = pos*vtkfont_width + col + 1;
300 x[1] = vtkfont_height - row;
302 ChangeOrientation(x,orientation);
303 newPoints->InsertNextPoint(x);
304 newScalars->InsertNextValue(white[0]);
305 newScalars->InsertNextValue(white[1]);
306 newScalars->InsertNextValue(white[2]);
307 newScalars->InsertNextValue(white[3]);
311 // if the pixel is not set the close up the rectangle
316 x[0] = pos*vtkfont_width + col + 1;
317 x[1] = vtkfont_height - row;
319 ChangeOrientation(x,orientation);
320 newPoints->InsertNextPoint(x);
321 newScalars->InsertNextValue(white[0]);
322 newScalars->InsertNextValue(white[1]);
323 newScalars->InsertNextValue(white[2]);
324 newScalars->InsertNextValue(white[3]);
326 x[0] = pos*vtkfont_width + col;
327 x[1] = vtkfont_height - row;
329 ChangeOrientation(x,orientation);
330 newPoints->InsertNextPoint(x);
331 newScalars->InsertNextValue(white[0]);
332 newScalars->InsertNextValue(white[1]);
333 newScalars->InsertNextValue(white[2]);
334 newScalars->InsertNextValue(white[3]);
337 pts[1] = numPolys*4 + 1;
338 pts[2] = numPolys*4 + 2;
339 pts[3] = numPolys*4 + 3;
340 newPolys->InsertNextCell(4,pts);
344 if (!drawingBlack && this->Backing)
346 x[0] = pos*vtkfont_width + col;
347 x[1] = vtkfont_height - row;
349 ChangeOrientation(x,orientation);
350 newPoints->InsertNextPoint(x);
351 newScalars->InsertNextValue(black[0]);
352 newScalars->InsertNextValue(black[1]);
353 newScalars->InsertNextValue(black[2]);
354 newScalars->InsertNextValue(black[3]);
356 x[0] = pos*vtkfont_width + col + 1;
357 x[1] = vtkfont_height - row;
359 ChangeOrientation(x,orientation);
360 newPoints->InsertNextPoint(x);
361 newScalars->InsertNextValue(black[0]);
362 newScalars->InsertNextValue(black[1]);
363 newScalars->InsertNextValue(black[2]);
364 newScalars->InsertNextValue(black[3]);
369 // if we finished up a row but are still drawing close it up
372 x[0] = pos*vtkfont_width + col + 1;
375 ChangeOrientation(x,orientation);
376 newPoints->InsertNextPoint(x);
377 newScalars->InsertNextValue(white[0]);
378 newScalars->InsertNextValue(white[1]);
379 newScalars->InsertNextValue(white[2]);
380 newScalars->InsertNextValue(white[3]);
382 x[0] = pos*vtkfont_width + col;
385 ChangeOrientation(x,orientation);
386 newPoints->InsertNextPoint(x);
387 newScalars->InsertNextValue(white[0]);
388 newScalars->InsertNextValue(white[1]);
389 newScalars->InsertNextValue(white[2]);
390 newScalars->InsertNextValue(white[3]);
393 pts[1] = numPolys*4 + 1;
394 pts[2] = numPolys*4 + 2;
395 pts[3] = numPolys*4 + 3;
396 newPolys->InsertNextCell(4,pts);
402 x[0] = pos*vtkfont_width + col + 1;
405 ChangeOrientation(x,orientation);
406 newPoints->InsertNextPoint(x);
407 newScalars->InsertNextValue(black[0]);
408 newScalars->InsertNextValue(black[1]);
409 newScalars->InsertNextValue(black[2]);
410 newScalars->InsertNextValue(black[3]);
412 x[0] = pos*vtkfont_width + col;
415 ChangeOrientation(x,orientation);
416 newPoints->InsertNextPoint(x);
417 newScalars->InsertNextValue(black[0]);
418 newScalars->InsertNextValue(black[1]);
419 newScalars->InsertNextValue(black[2]);
420 newScalars->InsertNextValue(black[3]);
423 pts[1] = numPolys*4 + 1;
424 pts[2] = numPolys*4 + 2;
425 pts[3] = numPolys*4 + 3;
426 newPolys->InsertNextCell(4,pts);
434 // draw a black square for a space
437 x[0] = pos*vtkfont_width;
438 x[1] = vtkfont_height;
440 ChangeOrientation(x,orientation);
441 newPoints->InsertNextPoint(x);
442 newScalars->InsertNextValue(black[0]);
443 newScalars->InsertNextValue(black[1]);
444 newScalars->InsertNextValue(black[2]);
445 newScalars->InsertNextValue(black[3]);
447 x[0] = pos*vtkfont_width + vtkfont_width;
448 x[1] = vtkfont_height;
450 ChangeOrientation(x,orientation);
451 newPoints->InsertNextPoint(x);
452 newScalars->InsertNextValue(black[0]);
453 newScalars->InsertNextValue(black[1]);
454 newScalars->InsertNextValue(black[2]);
455 newScalars->InsertNextValue(black[3]);
457 x[0] = pos*vtkfont_width + vtkfont_width;
460 ChangeOrientation(x,orientation);
461 newPoints->InsertNextPoint(x);
462 newScalars->InsertNextValue(black[0]);
463 newScalars->InsertNextValue(black[1]);
464 newScalars->InsertNextValue(black[2]);
465 newScalars->InsertNextValue(black[3]);
467 x[0] = pos*vtkfont_width;
470 ChangeOrientation(x,orientation);
471 newPoints->InsertNextPoint(x);
472 newScalars->InsertNextValue(black[0]);
473 newScalars->InsertNextValue(black[1]);
474 newScalars->InsertNextValue(black[2]);
475 newScalars->InsertNextValue(black[3]);
478 pts[1] = numPolys*4 + 1;
479 pts[2] = numPolys*4 + 2;
480 pts[3] = numPolys*4 + 3;
481 newPolys->InsertNextCell(4,pts);
489 void vvLandmarksGlyph::AddCrossGlyph(vtkPoints* newPts,vtkCellArray* newLines)
493 std::cout << "AddCross" << std::endl;
497 ptIds[0] = newPts->InsertNextPoint(x);
502 ptIds[1] = newPts->InsertNextPoint(x);
503 newLines->InsertNextCell(2,ptIds);
508 ptIds[0] = newPts->InsertNextPoint(x);
513 ptIds[1] = newPts->InsertNextPoint(x);
514 newLines->InsertNextCell(2,ptIds);
519 ptIds[0] = newPts->InsertNextPoint(x);
524 ptIds[1] = newPts->InsertNextPoint(x);
525 newLines->InsertNextCell(2,ptIds);
529 void vvLandmarksGlyph::ChangeOrientation(double v[3],int orientation)
550 assert(false); //This definitely shouldn't happen
557 void vvLandmarksGlyph::PrintSelf(ostream& os, vtkIndent indent)
559 this->Superclass::PrintSelf(os,indent);
561 os << indent << "Text: " << (this->Text ? this->Text : "(none)") << "\n";
562 os << indent << "Background Drawn: " << (this->Backing ? "On\n" : "Off\n");
563 os << indent << "ForegroundColor: (" << this->ForegroundColor[0] << ", "
564 << this->ForegroundColor[1] << ", " << this->ForegroundColor[2] << ")\n";
565 os << indent << "BackgroundColor: (" << this->BackgroundColor[0] << ", "
566 << this->BackgroundColor[1] << ", " << this->BackgroundColor[2] << ")\n";