1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vvLandmarksGlyph.cxx,v $
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
14 =========================================================================*/
15 #include "vvLandmarksGlyph.h"
17 #include "vtkCellArray.h"
18 #include "vtkInformation.h"
19 #include "vtkInformationVector.h"
20 #include "vtkObjectFactory.h"
21 #include "vtkPointData.h"
22 #include "vtkPoints.h"
23 #include "vtkPolyData.h"
24 #include "vtkUnsignedCharArray.h"
27 vtkCxxRevisionMacro(vvLandmarksGlyph, "$Revision: 1.1 $");
28 vtkStandardNewMacro(vvLandmarksGlyph);
30 #define vtkfont_width 9
31 //#define vtkfont_width 14
32 #define vtkfont_row_width 864
33 #define vtkfont_height 15
34 //#define vtkfont_height 20
35 static unsigned char vtkfont_bits[] = {
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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
43 0x00,0x00,0xe0,0x00,0x10,0x90,0x00,0x00,0x40,0x88,0x03,0x1c,0x10,0x08,0x00,
44 0x00,0x00,0x00,0x00,0x00,0x20,0x1c,0x10,0xf8,0xf8,0x03,0xe2,0x0f,0x8f,0x3f,
45 0x3e,0x7c,0x00,0x00,0x00,0x02,0x80,0x00,0x1f,0x3e,0x10,0xfc,0xf0,0xf1,0xe3,
46 0xcf,0x1f,0x1f,0x41,0x7c,0xe0,0x09,0x12,0x20,0x48,0x10,0x1f,0x3f,0x7c,0xfc,
47 0xf0,0xf1,0x27,0x48,0x90,0x20,0x41,0x82,0xfc,0xe1,0x11,0xc0,0x03,0x02,0x00,
48 0x0e,0x00,0x04,0x00,0x00,0x04,0x00,0x0e,0x00,0x01,0x00,0x00,0x08,0xc0,0x00,
49 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
50 0x80,0x83,0xe0,0x80,0x11,0xe0,0x00,0x10,0x90,0x90,0x80,0xa0,0x44,0x04,0x0c,
51 0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x22,0x18,0x04,0x01,0x02,0x23,
52 0x80,0x00,0x20,0x41,0x82,0x00,0x00,0x00,0x01,0x00,0x81,0x20,0x41,0x28,0x08,
53 0x09,0x22,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x08,0x11,0x20,0x48,0x90,0x20,
54 0x41,0x82,0x04,0x09,0x82,0x20,0x48,0x90,0x20,0x41,0x82,0x00,0x21,0x20,0x00,
55 0x02,0x05,0x00,0x0c,0x00,0x04,0x00,0x00,0x04,0x00,0x11,0x00,0x01,0x10,0x80,
56 0x08,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,
57 0x00,0x00,0x00,0x40,0x80,0x00,0x41,0x12,0xe0,0x00,0x10,0x90,0x90,0xe0,0xa3,
58 0x44,0x04,0x02,0x08,0x10,0x00,0x40,0x00,0x00,0x00,0x00,0x10,0x41,0x14,0x04,
59 0x01,0x81,0x22,0x40,0x00,0x20,0x41,0x82,0x00,0x00,0x80,0x00,0x00,0x82,0x20,
60 0x41,0x44,0x08,0x09,0x20,0x44,0x80,0x80,0x00,0x41,0x10,0x80,0x88,0x10,0x60,
61 0xcc,0x90,0x20,0x41,0x82,0x04,0x09,0x80,0x20,0x48,0x90,0x20,0x22,0x44,0x80,
62 0x20,0x20,0x00,0x82,0x08,0x00,0x10,0x00,0x04,0x00,0x00,0x04,0x00,0x11,0x00,
63 0x01,0x00,0x00,0x08,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
64 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00,0x41,0x0c,0xe0,0x00,0x10,0x00,
65 0xf8,0x91,0x40,0x42,0x04,0x00,0x04,0x20,0x88,0x40,0x00,0x00,0x00,0x00,0x08,
66 0x41,0x10,0x00,0x81,0x40,0xa2,0x47,0x00,0x10,0x41,0x82,0x20,0x40,0x40,0x00,
67 0x00,0x04,0x20,0x79,0x82,0x08,0x09,0x20,0x44,0x80,0x80,0x00,0x41,0x10,0x80,
68 0x48,0x10,0xa0,0x4a,0x91,0x20,0x41,0x82,0x04,0x09,0x80,0x20,0x88,0x88,0x20,
69 0x14,0x28,0x40,0x20,0x40,0x00,0x42,0x10,0x00,0x00,0x7c,0xf4,0xf0,0xe1,0xc5,
70 0x07,0x01,0x2f,0x3d,0x18,0xe0,0x08,0x82,0xe0,0x46,0x0f,0x1f,0x3d,0xbc,0xe4,
71 0xf0,0xf1,0x23,0x44,0x90,0x20,0x41,0x42,0xfc,0x81,0x80,0x80,0x00,0x00,0xe0,
72 0x00,0x10,0x00,0x90,0x90,0x00,0x81,0x03,0x00,0x04,0x20,0x50,0x40,0x00,0x00,
73 0x00,0x00,0x04,0x41,0x10,0x80,0xc0,0x21,0x62,0x48,0x0f,0x08,0x3e,0xc2,0x70,
74 0xe0,0x20,0xe0,0x0f,0x08,0x10,0x45,0x82,0xf8,0x08,0x20,0xc4,0x83,0x87,0x00,
75 0x7f,0x10,0x80,0x38,0x10,0xa0,0x4a,0x92,0x20,0x3f,0x82,0xfc,0xf0,0x81,0x20,
76 0x88,0x88,0x24,0x08,0x10,0x20,0x20,0x80,0x00,0x02,0x00,0x00,0x00,0x80,0x0c,
77 0x09,0x12,0x26,0x08,0x81,0x10,0x43,0x10,0x80,0x88,0x81,0x20,0xc9,0x90,0x20,
78 0x43,0xc2,0x18,0x09,0x42,0x20,0x44,0x90,0x20,0x22,0x42,0x80,0x60,0x80,0x00,
79 0x03,0x00,0xe0,0x00,0x10,0x00,0x90,0xe0,0x03,0x41,0x04,0x00,0x04,0x20,0xfc,
80 0xf9,0x03,0xe0,0x0f,0x00,0x04,0x41,0x10,0x40,0x00,0x12,0x02,0xc8,0x10,0x04,
81 0x41,0xbc,0x20,0x40,0x20,0x00,0x00,0x08,0x08,0x65,0x82,0x08,0x09,0x20,0x44,
82 0x80,0x80,0x38,0x41,0x10,0x80,0x28,0x10,0x20,0x49,0x94,0x20,0x01,0x82,0x24,
83 0x00,0x82,0x20,0x88,0x88,0x24,0x08,0x10,0x10,0x20,0x80,0x00,0x02,0x00,0x00,
84 0x00,0x80,0x04,0x09,0x10,0x24,0xc8,0x87,0x10,0x41,0x10,0x80,0x68,0x80,0x20,
85 0x49,0x90,0x20,0x41,0x82,0x08,0x09,0x40,0x20,0x84,0x88,0x24,0x14,0x42,0x40,
86 0x60,0x80,0x00,0x03,0x00,0xe0,0x00,0x10,0x00,0xf8,0x81,0x84,0x44,0x14,0x00,
87 0x04,0x20,0x50,0x40,0x00,0x00,0x00,0x00,0x02,0x41,0x10,0x30,0x00,0xf2,0x07,
88 0x48,0x10,0x02,0x41,0x80,0x00,0x00,0x40,0x00,0x00,0x04,0x04,0x59,0xfe,0x08,
89 0x09,0x20,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x48,0x10,0x20,0x49,0x98,0x20,
90 0x01,0x82,0x44,0x00,0x82,0x20,0x08,0x85,0x24,0x14,0x10,0x08,0x20,0x00,0x01,
91 0x02,0x00,0x00,0x00,0xfc,0x04,0x09,0x10,0xe4,0x0f,0x81,0x10,0x41,0x10,0x80,
92 0x18,0x80,0x20,0x49,0x90,0x20,0x41,0x82,0x08,0xf0,0x41,0x20,0x84,0x88,0x24,
93 0x08,0x42,0x20,0x80,0x80,0x80,0x00,0x00,0xe0,0x00,0x10,0x00,0x90,0x80,0x44,
94 0x4a,0x08,0x00,0x08,0x10,0x88,0x40,0x00,0x00,0x00,0x00,0x01,0x41,0x10,0x08,
95 0x00,0x02,0x02,0x48,0x10,0x02,0x41,0x80,0x00,0x00,0x80,0xe0,0x0f,0x02,0x04,
96 0x01,0x82,0x08,0x09,0x20,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x88,0x10,0x20,
97 0x48,0x90,0x20,0x01,0x92,0x84,0x00,0x82,0x20,0x08,0x85,0x24,0x22,0x10,0x04,
98 0x20,0x00,0x02,0x02,0x00,0x00,0x00,0x82,0x04,0x09,0x10,0x24,0x00,0x01,0x0f,
99 0x41,0x10,0x80,0x68,0x80,0x20,0x49,0x90,0x20,0x41,0x82,0x08,0x00,0x42,0x20,
100 0x04,0x85,0x24,0x14,0x42,0x10,0x40,0x80,0x00,0x01,0x00,0xe0,0x00,0x00,0x00,
101 0x90,0xe0,0x43,0x4a,0x0c,0x00,0x08,0x10,0x00,0x40,0xc0,0x01,0x00,0x02,0x01,
102 0x22,0x10,0x04,0x08,0x02,0x22,0x48,0x10,0x01,0x41,0x40,0x20,0xe0,0x00,0x01,
103 0x00,0x01,0x00,0x01,0x82,0x08,0x09,0x22,0x44,0x80,0x80,0x20,0x41,0x10,0x84,
104 0x08,0x11,0x20,0x48,0x90,0x20,0x01,0xa2,0x04,0x09,0x82,0x20,0x08,0x85,0x2a,
105 0x41,0x10,0x04,0x20,0x00,0x02,0x02,0x00,0x00,0x00,0xc2,0x0c,0x09,0x12,0x26,
106 0x00,0x81,0x00,0x41,0x10,0x80,0x88,0x81,0x20,0x49,0x90,0x20,0x43,0xc2,0x08,
107 0x08,0x42,0x24,0x04,0x85,0x2a,0x22,0x62,0x08,0x40,0x80,0x00,0x01,0x00,0xe0,
108 0x00,0x10,0x00,0x00,0x80,0x20,0x84,0x13,0x00,0x10,0x08,0x00,0x00,0xc0,0x00,
109 0x00,0x87,0x00,0x1c,0x7c,0xfc,0xf1,0x01,0xc2,0x87,0x0f,0x01,0x3e,0x3c,0x70,
110 0x60,0x00,0x02,0x80,0x00,0x04,0x3e,0x82,0xfc,0xf0,0xf1,0xe3,0x8f,0x00,0x1f,
111 0x41,0x7c,0x78,0x08,0xf2,0x27,0x48,0x10,0x1f,0x01,0x7c,0x04,0xf1,0x81,0xc0,
112 0x07,0x02,0x11,0x41,0x10,0xfc,0xe1,0x01,0xc4,0x03,0x00,0x00,0x00,0xbc,0xf4,
113 0xf0,0xe1,0xc5,0x07,0x01,0x1f,0x41,0x7c,0x84,0x08,0xe2,0x23,0x48,0x10,0x1f,
114 0x3d,0xbc,0x08,0xf0,0x81,0xc3,0x0b,0x02,0x11,0x41,0x5c,0xfc,0x81,0x83,0xe0,
115 0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
116 0x00,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
117 0x00,0x00,0x20,0x10,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,0x80,0x00,
119 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x3f,
120 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x00,0x00,0x84,0x00,0x00,0x00,
121 0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
122 0x00,0x00,0x00,0x00,0x00,0xe0,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,0x00,0x00,0x00,0x00,0x00,
127 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x00,0x00,0x84,
128 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
129 0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,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,0x00,
134 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,
135 0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,
136 0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,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,0x00,
143 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0
146 // Construct object with no string set and backing enabled.
147 vvLandmarksGlyph::vvLandmarksGlyph()
151 this->ForegroundColor[0] = 1.0;
152 this->ForegroundColor[1] = 1.0;
153 this->ForegroundColor[2] = 1.0;
154 this->ForegroundColor[3] = 1.0;
155 this->BackgroundColor[0] = 0.0;
156 this->BackgroundColor[1] = 0.0;
157 this->BackgroundColor[2] = 0.0;
158 this->BackgroundColor[3] = 1.0;
160 this->SetNumberOfInputPorts(0);
163 vvLandmarksGlyph::~vvLandmarksGlyph()
167 delete [] this->Text;
171 int vvLandmarksGlyph::RequestData(
172 vtkInformation *vtkNotUsed(request),
173 vtkInformationVector **vtkNotUsed(inputVector),
174 vtkInformationVector *outputVector)
176 // get the info object
177 vtkInformation *outInfo = outputVector->GetInformationObject(0);
180 vtkPolyData *output = vtkPolyData::SafeDownCast(
181 outInfo->Get(vtkDataObject::DATA_OBJECT()));
183 vtkPoints *newPoints;
184 vtkCellArray *newPolys;
185 vtkCellArray *newLines;
186 vtkUnsignedCharArray *newScalars;
188 newPoints = vtkPoints::New();
189 newPolys = vtkCellArray::New();
190 newScalars = vtkUnsignedCharArray::New();
191 newScalars->SetNumberOfComponents(4);
192 newLines = vtkCellArray::New();
193 newLines->Allocate(newLines->EstimateSize(3,2));
195 AddTextGlyph(newPoints,newScalars,newPolys,0);
196 AddTextGlyph(newPoints,newScalars,newPolys,1);
197 AddTextGlyph(newPoints,newScalars,newPolys,2);
199 AddCrossGlyph(newPoints, newLines);
201 output->SetPoints(newPoints);
204 output->SetLines(newLines);
207 output->GetPointData()->SetScalars(newScalars);
208 newScalars->Delete();
210 output->SetPolys(newPolys);
216 void vvLandmarksGlyph::AddTextGlyph(vtkPoints* newPoints,vtkUnsignedCharArray* newScalars, vtkCellArray *newPolys, int orientation)
222 vtkIdType numPolys = 0;
225 int drawingWhite = 0;
226 int drawingBlack = 0;
227 unsigned char white[4];
228 unsigned char black[4];
229 std::cout << "AddTextGlyph(output," << orientation << ")" << std::endl;
231 if (this->Text == NULL)
233 vtkErrorMacro (<< "Text is not set!");
237 // convert colors to unsigned char
238 for (int i = 0; i < 4; i++)
240 white[i] = (unsigned char) (this->ForegroundColor[i] * 255.0);
241 black[i] = (unsigned char) (this->BackgroundColor[i] * 255.0);
244 std::cout << "Create Text" << std::endl;
246 while (this->Text[pos])
248 if (this->Text[pos] != 32)
250 for (col = 0; col < vtkfont_width; col++)
252 acol = (this->Text[pos] - 32)*vtkfont_width + col - 1;
253 for (row = 0; row < vtkfont_height; row++)
255 pixelPos = acol + row*vtkfont_row_width;
256 if (vtkfont_bits[pixelPos/8] & (0x01 << pixelPos%8))
260 x[0] = pos*vtkfont_width + col + 1;
261 x[1] = vtkfont_height - row;
263 ChangeOrientation(x,orientation);
264 newPoints->InsertNextPoint(x);
265 newScalars->InsertNextValue(black[0]);
266 newScalars->InsertNextValue(black[1]);
267 newScalars->InsertNextValue(black[2]);
268 newScalars->InsertNextValue(black[3]);
270 x[0] = pos*vtkfont_width + col;
271 x[1] = vtkfont_height - row;
273 ChangeOrientation(x,orientation);
274 newPoints->InsertNextPoint(x);
275 newScalars->InsertNextValue(black[0]);
276 newScalars->InsertNextValue(black[1]);
277 newScalars->InsertNextValue(black[2]);
278 newScalars->InsertNextValue(black[3]);
281 pts[1] = numPolys*4 + 1;
282 pts[2] = numPolys*4 + 2;
283 pts[3] = numPolys*4 + 3;
284 newPolys->InsertNextCell(4,pts);
290 x[0] = pos*vtkfont_width + col;
291 x[1] = vtkfont_height - row;
293 ChangeOrientation(x,orientation);
294 newPoints->InsertNextPoint(x);
295 newScalars->InsertNextValue(white[0]);
296 newScalars->InsertNextValue(white[1]);
297 newScalars->InsertNextValue(white[2]);
298 newScalars->InsertNextValue(white[3]);
300 x[0] = pos*vtkfont_width + col + 1;
301 x[1] = vtkfont_height - row;
303 ChangeOrientation(x,orientation);
304 newPoints->InsertNextPoint(x);
305 newScalars->InsertNextValue(white[0]);
306 newScalars->InsertNextValue(white[1]);
307 newScalars->InsertNextValue(white[2]);
308 newScalars->InsertNextValue(white[3]);
312 // if the pixel is not set the close up the rectangle
317 x[0] = pos*vtkfont_width + col + 1;
318 x[1] = vtkfont_height - row;
320 ChangeOrientation(x,orientation);
321 newPoints->InsertNextPoint(x);
322 newScalars->InsertNextValue(white[0]);
323 newScalars->InsertNextValue(white[1]);
324 newScalars->InsertNextValue(white[2]);
325 newScalars->InsertNextValue(white[3]);
327 x[0] = pos*vtkfont_width + col;
328 x[1] = vtkfont_height - row;
330 ChangeOrientation(x,orientation);
331 newPoints->InsertNextPoint(x);
332 newScalars->InsertNextValue(white[0]);
333 newScalars->InsertNextValue(white[1]);
334 newScalars->InsertNextValue(white[2]);
335 newScalars->InsertNextValue(white[3]);
338 pts[1] = numPolys*4 + 1;
339 pts[2] = numPolys*4 + 2;
340 pts[3] = numPolys*4 + 3;
341 newPolys->InsertNextCell(4,pts);
345 if (!drawingBlack && this->Backing)
347 x[0] = pos*vtkfont_width + col;
348 x[1] = vtkfont_height - row;
350 ChangeOrientation(x,orientation);
351 newPoints->InsertNextPoint(x);
352 newScalars->InsertNextValue(black[0]);
353 newScalars->InsertNextValue(black[1]);
354 newScalars->InsertNextValue(black[2]);
355 newScalars->InsertNextValue(black[3]);
357 x[0] = pos*vtkfont_width + col + 1;
358 x[1] = vtkfont_height - row;
360 ChangeOrientation(x,orientation);
361 newPoints->InsertNextPoint(x);
362 newScalars->InsertNextValue(black[0]);
363 newScalars->InsertNextValue(black[1]);
364 newScalars->InsertNextValue(black[2]);
365 newScalars->InsertNextValue(black[3]);
370 // if we finished up a row but are still drawing close it up
373 x[0] = pos*vtkfont_width + col + 1;
376 ChangeOrientation(x,orientation);
377 newPoints->InsertNextPoint(x);
378 newScalars->InsertNextValue(white[0]);
379 newScalars->InsertNextValue(white[1]);
380 newScalars->InsertNextValue(white[2]);
381 newScalars->InsertNextValue(white[3]);
383 x[0] = pos*vtkfont_width + col;
386 ChangeOrientation(x,orientation);
387 newPoints->InsertNextPoint(x);
388 newScalars->InsertNextValue(white[0]);
389 newScalars->InsertNextValue(white[1]);
390 newScalars->InsertNextValue(white[2]);
391 newScalars->InsertNextValue(white[3]);
394 pts[1] = numPolys*4 + 1;
395 pts[2] = numPolys*4 + 2;
396 pts[3] = numPolys*4 + 3;
397 newPolys->InsertNextCell(4,pts);
403 x[0] = pos*vtkfont_width + col + 1;
406 ChangeOrientation(x,orientation);
407 newPoints->InsertNextPoint(x);
408 newScalars->InsertNextValue(black[0]);
409 newScalars->InsertNextValue(black[1]);
410 newScalars->InsertNextValue(black[2]);
411 newScalars->InsertNextValue(black[3]);
413 x[0] = pos*vtkfont_width + col;
416 ChangeOrientation(x,orientation);
417 newPoints->InsertNextPoint(x);
418 newScalars->InsertNextValue(black[0]);
419 newScalars->InsertNextValue(black[1]);
420 newScalars->InsertNextValue(black[2]);
421 newScalars->InsertNextValue(black[3]);
424 pts[1] = numPolys*4 + 1;
425 pts[2] = numPolys*4 + 2;
426 pts[3] = numPolys*4 + 3;
427 newPolys->InsertNextCell(4,pts);
435 // draw a black square for a space
438 x[0] = pos*vtkfont_width;
439 x[1] = vtkfont_height;
441 ChangeOrientation(x,orientation);
442 newPoints->InsertNextPoint(x);
443 newScalars->InsertNextValue(black[0]);
444 newScalars->InsertNextValue(black[1]);
445 newScalars->InsertNextValue(black[2]);
446 newScalars->InsertNextValue(black[3]);
448 x[0] = pos*vtkfont_width + vtkfont_width;
449 x[1] = vtkfont_height;
451 ChangeOrientation(x,orientation);
452 newPoints->InsertNextPoint(x);
453 newScalars->InsertNextValue(black[0]);
454 newScalars->InsertNextValue(black[1]);
455 newScalars->InsertNextValue(black[2]);
456 newScalars->InsertNextValue(black[3]);
458 x[0] = pos*vtkfont_width + vtkfont_width;
461 ChangeOrientation(x,orientation);
462 newPoints->InsertNextPoint(x);
463 newScalars->InsertNextValue(black[0]);
464 newScalars->InsertNextValue(black[1]);
465 newScalars->InsertNextValue(black[2]);
466 newScalars->InsertNextValue(black[3]);
468 x[0] = pos*vtkfont_width;
471 ChangeOrientation(x,orientation);
472 newPoints->InsertNextPoint(x);
473 newScalars->InsertNextValue(black[0]);
474 newScalars->InsertNextValue(black[1]);
475 newScalars->InsertNextValue(black[2]);
476 newScalars->InsertNextValue(black[3]);
479 pts[1] = numPolys*4 + 1;
480 pts[2] = numPolys*4 + 2;
481 pts[3] = numPolys*4 + 3;
482 newPolys->InsertNextCell(4,pts);
490 void vvLandmarksGlyph::AddCrossGlyph(vtkPoints* newPts,vtkCellArray* newLines)
494 std::cout << "AddCross" << std::endl;
498 ptIds[0] = newPts->InsertNextPoint(x);
503 ptIds[1] = newPts->InsertNextPoint(x);
504 newLines->InsertNextCell(2,ptIds);
509 ptIds[0] = newPts->InsertNextPoint(x);
514 ptIds[1] = newPts->InsertNextPoint(x);
515 newLines->InsertNextCell(2,ptIds);
520 ptIds[0] = newPts->InsertNextPoint(x);
525 ptIds[1] = newPts->InsertNextPoint(x);
526 newLines->InsertNextCell(2,ptIds);
530 void vvLandmarksGlyph::ChangeOrientation(double v[3],int orientation)
551 assert(false); //This definitely shouldn't happen
558 void vvLandmarksGlyph::PrintSelf(ostream& os, vtkIndent indent)
560 this->Superclass::PrintSelf(os,indent);
562 os << indent << "Text: " << (this->Text ? this->Text : "(none)") << "\n";
563 os << indent << "Background Drawn: " << (this->Backing ? "On\n" : "Off\n");
564 os << indent << "ForegroundColor: (" << this->ForegroundColor[0] << ", "
565 << this->ForegroundColor[1] << ", " << this->ForegroundColor[2] << ")\n";
566 os << indent << "BackgroundColor: (" << this->BackgroundColor[0] << ", "
567 << this->BackgroundColor[1] << ", " << this->BackgroundColor[2] << ")\n";