1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
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 copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #include "vvLandmarksGlyph.h"
20 #include "vtkCellArray.h"
21 #include "vtkInformation.h"
22 #include "vtkInformationVector.h"
23 #include "vtkObjectFactory.h"
24 #include "vtkPointData.h"
25 #include "vtkPoints.h"
26 #include "vtkPolyData.h"
27 #include "vtkUnsignedCharArray.h"
30 vtkCxxRevisionMacro(vvLandmarksGlyph, "DummyRevision");
31 vtkStandardNewMacro(vvLandmarksGlyph);
33 #define vtkfont_width 9
34 //#define vtkfont_width 14
35 #define vtkfont_row_width 864
36 #define vtkfont_height 15
37 //#define vtkfont_height 20
38 static unsigned char vtkfont_bits[] = {
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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
44 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
45 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
46 0x00,0x00,0xe0,0x00,0x10,0x90,0x00,0x00,0x40,0x88,0x03,0x1c,0x10,0x08,0x00,
47 0x00,0x00,0x00,0x00,0x00,0x20,0x1c,0x10,0xf8,0xf8,0x03,0xe2,0x0f,0x8f,0x3f,
48 0x3e,0x7c,0x00,0x00,0x00,0x02,0x80,0x00,0x1f,0x3e,0x10,0xfc,0xf0,0xf1,0xe3,
49 0xcf,0x1f,0x1f,0x41,0x7c,0xe0,0x09,0x12,0x20,0x48,0x10,0x1f,0x3f,0x7c,0xfc,
50 0xf0,0xf1,0x27,0x48,0x90,0x20,0x41,0x82,0xfc,0xe1,0x11,0xc0,0x03,0x02,0x00,
51 0x0e,0x00,0x04,0x00,0x00,0x04,0x00,0x0e,0x00,0x01,0x00,0x00,0x08,0xc0,0x00,
52 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
53 0x80,0x83,0xe0,0x80,0x11,0xe0,0x00,0x10,0x90,0x90,0x80,0xa0,0x44,0x04,0x0c,
54 0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x22,0x18,0x04,0x01,0x02,0x23,
55 0x80,0x00,0x20,0x41,0x82,0x00,0x00,0x00,0x01,0x00,0x81,0x20,0x41,0x28,0x08,
56 0x09,0x22,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x08,0x11,0x20,0x48,0x90,0x20,
57 0x41,0x82,0x04,0x09,0x82,0x20,0x48,0x90,0x20,0x41,0x82,0x00,0x21,0x20,0x00,
58 0x02,0x05,0x00,0x0c,0x00,0x04,0x00,0x00,0x04,0x00,0x11,0x00,0x01,0x10,0x80,
59 0x08,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,
60 0x00,0x00,0x00,0x40,0x80,0x00,0x41,0x12,0xe0,0x00,0x10,0x90,0x90,0xe0,0xa3,
61 0x44,0x04,0x02,0x08,0x10,0x00,0x40,0x00,0x00,0x00,0x00,0x10,0x41,0x14,0x04,
62 0x01,0x81,0x22,0x40,0x00,0x20,0x41,0x82,0x00,0x00,0x80,0x00,0x00,0x82,0x20,
63 0x41,0x44,0x08,0x09,0x20,0x44,0x80,0x80,0x00,0x41,0x10,0x80,0x88,0x10,0x60,
64 0xcc,0x90,0x20,0x41,0x82,0x04,0x09,0x80,0x20,0x48,0x90,0x20,0x22,0x44,0x80,
65 0x20,0x20,0x00,0x82,0x08,0x00,0x10,0x00,0x04,0x00,0x00,0x04,0x00,0x11,0x00,
66 0x01,0x00,0x00,0x08,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
67 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00,0x41,0x0c,0xe0,0x00,0x10,0x00,
68 0xf8,0x91,0x40,0x42,0x04,0x00,0x04,0x20,0x88,0x40,0x00,0x00,0x00,0x00,0x08,
69 0x41,0x10,0x00,0x81,0x40,0xa2,0x47,0x00,0x10,0x41,0x82,0x20,0x40,0x40,0x00,
70 0x00,0x04,0x20,0x79,0x82,0x08,0x09,0x20,0x44,0x80,0x80,0x00,0x41,0x10,0x80,
71 0x48,0x10,0xa0,0x4a,0x91,0x20,0x41,0x82,0x04,0x09,0x80,0x20,0x88,0x88,0x20,
72 0x14,0x28,0x40,0x20,0x40,0x00,0x42,0x10,0x00,0x00,0x7c,0xf4,0xf0,0xe1,0xc5,
73 0x07,0x01,0x2f,0x3d,0x18,0xe0,0x08,0x82,0xe0,0x46,0x0f,0x1f,0x3d,0xbc,0xe4,
74 0xf0,0xf1,0x23,0x44,0x90,0x20,0x41,0x42,0xfc,0x81,0x80,0x80,0x00,0x00,0xe0,
75 0x00,0x10,0x00,0x90,0x90,0x00,0x81,0x03,0x00,0x04,0x20,0x50,0x40,0x00,0x00,
76 0x00,0x00,0x04,0x41,0x10,0x80,0xc0,0x21,0x62,0x48,0x0f,0x08,0x3e,0xc2,0x70,
77 0xe0,0x20,0xe0,0x0f,0x08,0x10,0x45,0x82,0xf8,0x08,0x20,0xc4,0x83,0x87,0x00,
78 0x7f,0x10,0x80,0x38,0x10,0xa0,0x4a,0x92,0x20,0x3f,0x82,0xfc,0xf0,0x81,0x20,
79 0x88,0x88,0x24,0x08,0x10,0x20,0x20,0x80,0x00,0x02,0x00,0x00,0x00,0x80,0x0c,
80 0x09,0x12,0x26,0x08,0x81,0x10,0x43,0x10,0x80,0x88,0x81,0x20,0xc9,0x90,0x20,
81 0x43,0xc2,0x18,0x09,0x42,0x20,0x44,0x90,0x20,0x22,0x42,0x80,0x60,0x80,0x00,
82 0x03,0x00,0xe0,0x00,0x10,0x00,0x90,0xe0,0x03,0x41,0x04,0x00,0x04,0x20,0xfc,
83 0xf9,0x03,0xe0,0x0f,0x00,0x04,0x41,0x10,0x40,0x00,0x12,0x02,0xc8,0x10,0x04,
84 0x41,0xbc,0x20,0x40,0x20,0x00,0x00,0x08,0x08,0x65,0x82,0x08,0x09,0x20,0x44,
85 0x80,0x80,0x38,0x41,0x10,0x80,0x28,0x10,0x20,0x49,0x94,0x20,0x01,0x82,0x24,
86 0x00,0x82,0x20,0x88,0x88,0x24,0x08,0x10,0x10,0x20,0x80,0x00,0x02,0x00,0x00,
87 0x00,0x80,0x04,0x09,0x10,0x24,0xc8,0x87,0x10,0x41,0x10,0x80,0x68,0x80,0x20,
88 0x49,0x90,0x20,0x41,0x82,0x08,0x09,0x40,0x20,0x84,0x88,0x24,0x14,0x42,0x40,
89 0x60,0x80,0x00,0x03,0x00,0xe0,0x00,0x10,0x00,0xf8,0x81,0x84,0x44,0x14,0x00,
90 0x04,0x20,0x50,0x40,0x00,0x00,0x00,0x00,0x02,0x41,0x10,0x30,0x00,0xf2,0x07,
91 0x48,0x10,0x02,0x41,0x80,0x00,0x00,0x40,0x00,0x00,0x04,0x04,0x59,0xfe,0x08,
92 0x09,0x20,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x48,0x10,0x20,0x49,0x98,0x20,
93 0x01,0x82,0x44,0x00,0x82,0x20,0x08,0x85,0x24,0x14,0x10,0x08,0x20,0x00,0x01,
94 0x02,0x00,0x00,0x00,0xfc,0x04,0x09,0x10,0xe4,0x0f,0x81,0x10,0x41,0x10,0x80,
95 0x18,0x80,0x20,0x49,0x90,0x20,0x41,0x82,0x08,0xf0,0x41,0x20,0x84,0x88,0x24,
96 0x08,0x42,0x20,0x80,0x80,0x80,0x00,0x00,0xe0,0x00,0x10,0x00,0x90,0x80,0x44,
97 0x4a,0x08,0x00,0x08,0x10,0x88,0x40,0x00,0x00,0x00,0x00,0x01,0x41,0x10,0x08,
98 0x00,0x02,0x02,0x48,0x10,0x02,0x41,0x80,0x00,0x00,0x80,0xe0,0x0f,0x02,0x04,
99 0x01,0x82,0x08,0x09,0x20,0x44,0x80,0x80,0x20,0x41,0x10,0x80,0x88,0x10,0x20,
100 0x48,0x90,0x20,0x01,0x92,0x84,0x00,0x82,0x20,0x08,0x85,0x24,0x22,0x10,0x04,
101 0x20,0x00,0x02,0x02,0x00,0x00,0x00,0x82,0x04,0x09,0x10,0x24,0x00,0x01,0x0f,
102 0x41,0x10,0x80,0x68,0x80,0x20,0x49,0x90,0x20,0x41,0x82,0x08,0x00,0x42,0x20,
103 0x04,0x85,0x24,0x14,0x42,0x10,0x40,0x80,0x00,0x01,0x00,0xe0,0x00,0x00,0x00,
104 0x90,0xe0,0x43,0x4a,0x0c,0x00,0x08,0x10,0x00,0x40,0xc0,0x01,0x00,0x02,0x01,
105 0x22,0x10,0x04,0x08,0x02,0x22,0x48,0x10,0x01,0x41,0x40,0x20,0xe0,0x00,0x01,
106 0x00,0x01,0x00,0x01,0x82,0x08,0x09,0x22,0x44,0x80,0x80,0x20,0x41,0x10,0x84,
107 0x08,0x11,0x20,0x48,0x90,0x20,0x01,0xa2,0x04,0x09,0x82,0x20,0x08,0x85,0x2a,
108 0x41,0x10,0x04,0x20,0x00,0x02,0x02,0x00,0x00,0x00,0xc2,0x0c,0x09,0x12,0x26,
109 0x00,0x81,0x00,0x41,0x10,0x80,0x88,0x81,0x20,0x49,0x90,0x20,0x43,0xc2,0x08,
110 0x08,0x42,0x24,0x04,0x85,0x2a,0x22,0x62,0x08,0x40,0x80,0x00,0x01,0x00,0xe0,
111 0x00,0x10,0x00,0x00,0x80,0x20,0x84,0x13,0x00,0x10,0x08,0x00,0x00,0xc0,0x00,
112 0x00,0x87,0x00,0x1c,0x7c,0xfc,0xf1,0x01,0xc2,0x87,0x0f,0x01,0x3e,0x3c,0x70,
113 0x60,0x00,0x02,0x80,0x00,0x04,0x3e,0x82,0xfc,0xf0,0xf1,0xe3,0x8f,0x00,0x1f,
114 0x41,0x7c,0x78,0x08,0xf2,0x27,0x48,0x10,0x1f,0x01,0x7c,0x04,0xf1,0x81,0xc0,
115 0x07,0x02,0x11,0x41,0x10,0xfc,0xe1,0x01,0xc4,0x03,0x00,0x00,0x00,0xbc,0xf4,
116 0xf0,0xe1,0xc5,0x07,0x01,0x1f,0x41,0x7c,0x84,0x08,0xe2,0x23,0x48,0x10,0x1f,
117 0x3d,0xbc,0x08,0xf0,0x81,0xc3,0x0b,0x02,0x11,0x41,0x5c,0xfc,0x81,0x83,0xe0,
118 0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
119 0x00,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
120 0x00,0x00,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
121 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,
122 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x3f,
123 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x00,0x00,0x84,0x00,0x00,0x00,
124 0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
125 0x00,0x00,0x00,0x00,0x00,0xe0,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,0x00,
130 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x00,0x00,0x84,
131 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
132 0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,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,0x00,
135 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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,0x1f,
138 0x00,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,
139 0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,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,0x00,
144 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
145 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
146 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0
149 // Construct object with no string set and backing enabled.
150 vvLandmarksGlyph::vvLandmarksGlyph()
154 this->ForegroundColor[0] = 1.0;
155 this->ForegroundColor[1] = 1.0;
156 this->ForegroundColor[2] = 1.0;
157 this->ForegroundColor[3] = 1.0;
158 this->BackgroundColor[0] = 0.0;
159 this->BackgroundColor[1] = 0.0;
160 this->BackgroundColor[2] = 0.0;
161 this->BackgroundColor[3] = 1.0;
163 this->SetNumberOfInputPorts(0);
166 vvLandmarksGlyph::~vvLandmarksGlyph()
169 delete [] this->Text;
173 int vvLandmarksGlyph::RequestData(
174 vtkInformation *vtkNotUsed(request),
175 vtkInformationVector **vtkNotUsed(inputVector),
176 vtkInformationVector *outputVector)
178 // get the info object
179 vtkInformation *outInfo = outputVector->GetInformationObject(0);
182 vtkPolyData *output = vtkPolyData::SafeDownCast(
183 outInfo->Get(vtkDataObject::DATA_OBJECT()));
185 vtkPoints *newPoints;
186 vtkCellArray *newPolys;
187 vtkCellArray *newLines;
188 vtkUnsignedCharArray *newScalars;
190 newPoints = vtkPoints::New();
191 newPolys = vtkCellArray::New();
192 newScalars = vtkUnsignedCharArray::New();
193 newScalars->SetNumberOfComponents(4);
194 newLines = vtkCellArray::New();
195 newLines->Allocate(newLines->EstimateSize(3,2));
197 AddTextGlyph(newPoints,newScalars,newPolys,0);
198 AddTextGlyph(newPoints,newScalars,newPolys,1);
199 AddTextGlyph(newPoints,newScalars,newPolys,2);
201 AddCrossGlyph(newPoints, newLines);
203 output->SetPoints(newPoints);
206 output->SetLines(newLines);
209 output->GetPointData()->SetScalars(newScalars);
210 newScalars->Delete();
212 output->SetPolys(newPolys);
218 void vvLandmarksGlyph::AddTextGlyph(vtkPoints* newPoints,vtkUnsignedCharArray* newScalars, vtkCellArray *newPolys, int orientation)
224 vtkIdType numPolys = 0;
227 int drawingWhite = 0;
228 int drawingBlack = 0;
229 unsigned char white[4];
230 unsigned char black[4];
231 std::cout << "AddTextGlyph(output," << orientation << ")" << std::endl;
233 if (this->Text == NULL) {
234 vtkErrorMacro (<< "Text is not set!");
238 // convert colors to unsigned char
239 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]) {
247 if (this->Text[pos] != 32) {
248 for (col = 0; col < vtkfont_width; col++) {
249 acol = (this->Text[pos] - 32)*vtkfont_width + col - 1;
250 for (row = 0; row < vtkfont_height; row++) {
251 pixelPos = acol + row*vtkfont_row_width;
252 if (vtkfont_bits[pixelPos/8] & (0x01 << pixelPos%8)) {
254 x[0] = pos*vtkfont_width + col + 1;
255 x[1] = vtkfont_height - row;
257 ChangeOrientation(x,orientation);
258 newPoints->InsertNextPoint(x);
259 newScalars->InsertNextValue(black[0]);
260 newScalars->InsertNextValue(black[1]);
261 newScalars->InsertNextValue(black[2]);
262 newScalars->InsertNextValue(black[3]);
264 x[0] = pos*vtkfont_width + col;
265 x[1] = vtkfont_height - row;
267 ChangeOrientation(x,orientation);
268 newPoints->InsertNextPoint(x);
269 newScalars->InsertNextValue(black[0]);
270 newScalars->InsertNextValue(black[1]);
271 newScalars->InsertNextValue(black[2]);
272 newScalars->InsertNextValue(black[3]);
275 pts[1] = numPolys*4 + 1;
276 pts[2] = numPolys*4 + 2;
277 pts[3] = numPolys*4 + 3;
278 newPolys->InsertNextCell(4,pts);
283 x[0] = pos*vtkfont_width + col;
284 x[1] = vtkfont_height - row;
286 ChangeOrientation(x,orientation);
287 newPoints->InsertNextPoint(x);
288 newScalars->InsertNextValue(white[0]);
289 newScalars->InsertNextValue(white[1]);
290 newScalars->InsertNextValue(white[2]);
291 newScalars->InsertNextValue(white[3]);
293 x[0] = pos*vtkfont_width + col + 1;
294 x[1] = vtkfont_height - row;
296 ChangeOrientation(x,orientation);
297 newPoints->InsertNextPoint(x);
298 newScalars->InsertNextValue(white[0]);
299 newScalars->InsertNextValue(white[1]);
300 newScalars->InsertNextValue(white[2]);
301 newScalars->InsertNextValue(white[3]);
305 // if the pixel is not set the close up the rectangle
308 x[0] = pos*vtkfont_width + col + 1;
309 x[1] = vtkfont_height - row;
311 ChangeOrientation(x,orientation);
312 newPoints->InsertNextPoint(x);
313 newScalars->InsertNextValue(white[0]);
314 newScalars->InsertNextValue(white[1]);
315 newScalars->InsertNextValue(white[2]);
316 newScalars->InsertNextValue(white[3]);
318 x[0] = pos*vtkfont_width + col;
319 x[1] = vtkfont_height - row;
321 ChangeOrientation(x,orientation);
322 newPoints->InsertNextPoint(x);
323 newScalars->InsertNextValue(white[0]);
324 newScalars->InsertNextValue(white[1]);
325 newScalars->InsertNextValue(white[2]);
326 newScalars->InsertNextValue(white[3]);
329 pts[1] = numPolys*4 + 1;
330 pts[2] = numPolys*4 + 2;
331 pts[3] = numPolys*4 + 3;
332 newPolys->InsertNextCell(4,pts);
336 if (!drawingBlack && this->Backing) {
337 x[0] = pos*vtkfont_width + col;
338 x[1] = vtkfont_height - row;
340 ChangeOrientation(x,orientation);
341 newPoints->InsertNextPoint(x);
342 newScalars->InsertNextValue(black[0]);
343 newScalars->InsertNextValue(black[1]);
344 newScalars->InsertNextValue(black[2]);
345 newScalars->InsertNextValue(black[3]);
347 x[0] = pos*vtkfont_width + col + 1;
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]);
360 // if we finished up a row but are still drawing close it up
362 x[0] = pos*vtkfont_width + col + 1;
365 ChangeOrientation(x,orientation);
366 newPoints->InsertNextPoint(x);
367 newScalars->InsertNextValue(white[0]);
368 newScalars->InsertNextValue(white[1]);
369 newScalars->InsertNextValue(white[2]);
370 newScalars->InsertNextValue(white[3]);
372 x[0] = pos*vtkfont_width + col;
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]);
383 pts[1] = numPolys*4 + 1;
384 pts[2] = numPolys*4 + 2;
385 pts[3] = numPolys*4 + 3;
386 newPolys->InsertNextCell(4,pts);
391 x[0] = pos*vtkfont_width + col + 1;
394 ChangeOrientation(x,orientation);
395 newPoints->InsertNextPoint(x);
396 newScalars->InsertNextValue(black[0]);
397 newScalars->InsertNextValue(black[1]);
398 newScalars->InsertNextValue(black[2]);
399 newScalars->InsertNextValue(black[3]);
401 x[0] = pos*vtkfont_width + col;
404 ChangeOrientation(x,orientation);
405 newPoints->InsertNextPoint(x);
406 newScalars->InsertNextValue(black[0]);
407 newScalars->InsertNextValue(black[1]);
408 newScalars->InsertNextValue(black[2]);
409 newScalars->InsertNextValue(black[3]);
412 pts[1] = numPolys*4 + 1;
413 pts[2] = numPolys*4 + 2;
414 pts[3] = numPolys*4 + 3;
415 newPolys->InsertNextCell(4,pts);
421 // draw a black square for a space
423 x[0] = pos*vtkfont_width;
424 x[1] = vtkfont_height;
426 ChangeOrientation(x,orientation);
427 newPoints->InsertNextPoint(x);
428 newScalars->InsertNextValue(black[0]);
429 newScalars->InsertNextValue(black[1]);
430 newScalars->InsertNextValue(black[2]);
431 newScalars->InsertNextValue(black[3]);
433 x[0] = pos*vtkfont_width + vtkfont_width;
434 x[1] = vtkfont_height;
436 ChangeOrientation(x,orientation);
437 newPoints->InsertNextPoint(x);
438 newScalars->InsertNextValue(black[0]);
439 newScalars->InsertNextValue(black[1]);
440 newScalars->InsertNextValue(black[2]);
441 newScalars->InsertNextValue(black[3]);
443 x[0] = pos*vtkfont_width + vtkfont_width;
446 ChangeOrientation(x,orientation);
447 newPoints->InsertNextPoint(x);
448 newScalars->InsertNextValue(black[0]);
449 newScalars->InsertNextValue(black[1]);
450 newScalars->InsertNextValue(black[2]);
451 newScalars->InsertNextValue(black[3]);
453 x[0] = pos*vtkfont_width;
456 ChangeOrientation(x,orientation);
457 newPoints->InsertNextPoint(x);
458 newScalars->InsertNextValue(black[0]);
459 newScalars->InsertNextValue(black[1]);
460 newScalars->InsertNextValue(black[2]);
461 newScalars->InsertNextValue(black[3]);
464 pts[1] = numPolys*4 + 1;
465 pts[2] = numPolys*4 + 2;
466 pts[3] = numPolys*4 + 3;
467 newPolys->InsertNextCell(4,pts);
475 void vvLandmarksGlyph::AddCrossGlyph(vtkPoints* newPts,vtkCellArray* newLines)
479 std::cout << "AddCross" << std::endl;
483 ptIds[0] = newPts->InsertNextPoint(x);
488 ptIds[1] = newPts->InsertNextPoint(x);
489 newLines->InsertNextCell(2,ptIds);
494 ptIds[0] = newPts->InsertNextPoint(x);
499 ptIds[1] = newPts->InsertNextPoint(x);
500 newLines->InsertNextCell(2,ptIds);
505 ptIds[0] = newPts->InsertNextPoint(x);
510 ptIds[1] = newPts->InsertNextPoint(x);
511 newLines->InsertNextCell(2,ptIds);
515 void vvLandmarksGlyph::ChangeOrientation(double v[3],int orientation)
518 switch (orientation) {
535 assert(false); //This definitely shouldn't happen
542 void vvLandmarksGlyph::PrintSelf(ostream& os, vtkIndent indent)
544 this->Superclass::PrintSelf(os,indent);
546 os << indent << "Text: " << (this->Text ? this->Text : "(none)") << "\n";
547 os << indent << "Background Drawn: " << (this->Backing ? "On\n" : "Off\n");
548 os << indent << "ForegroundColor: (" << this->ForegroundColor[0] << ", "
549 << this->ForegroundColor[1] << ", " << this->ForegroundColor[2] << ")\n";
550 os << indent << "BackgroundColor: (" << this->BackgroundColor[0] << ", "
551 << this->BackgroundColor[1] << ", " << this->BackgroundColor[2] << ")\n";