source: osm/applications/editors/josm/plugins/smed2/src/render/Signals.java@ 30157

Last change on this file since 30157 was 30157, checked in by malcolmh, 11 years ago

save

File size: 22.2 KB
Line 
1/* Copyright 2013 Malcolm Herring
2 *
3 * This is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License.
6 *
7 * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
8 */
9
10package render;
11
12import java.awt.Color;
13import java.awt.Font;
14import java.awt.geom.*;
15import java.util.ArrayList;
16
17import s57.S57att.*;
18import s57.S57obj.*;
19import s57.S57val.*;
20import s57.S57map.*;
21import render.Renderer.*;
22import symbols.Beacons;
23import symbols.Topmarks;
24import symbols.Symbols.*;
25
26public class Signals {
27
28 public static void addSignals(Feature feature) {
29 if (feature.objs.containsKey(Obj.FOGSIG)) fogSignals(feature);
30 if (feature.objs.containsKey(Obj.RTPBCN)) radarStations(feature);
31 if (feature.objs.containsKey(Obj.RADSTA)) radarStations(feature);
32 if (feature.objs.containsKey(Obj.RDOSTA)) radioStations(feature);
33 if (feature.objs.containsKey(Obj.LIGHTS)) lights(feature);
34 }
35
36 public static void fogSignals(Feature feature) {
37
38 }
39
40 public static void radarStations(Feature feature) {
41 Renderer.symbol(feature, Beacons.RadarStation);
42 String bstr = "";
43 CatRTB cat = (CatRTB) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.CATRTB);
44 switch (cat) {
45 case RTB_RAMK:
46 bstr += " Ramark";
47 break;
48 case RTB_RACN:
49 bstr += " Racon";
50 String astr = (String) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.SIGGRP);
51 if (!astr.isEmpty()) {
52 bstr += "(" + astr + ")";
53 }
54 Double per = (Double) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.SIGPER);
55 Double mxr = (Double) Rules.getAttVal(feature, Obj.RTPBCN, 0, Att.VALMXR);
56 if ((per != 0) || (mxr != 0)) {
57 bstr += (astr.isEmpty() ? " " : "");
58 bstr += (per != 0) ? per.toString() + "s" : "";
59 bstr += (mxr != 0) ? mxr.toString() + "M" : "";
60 }
61 break;
62 default:
63 break;
64 }
65 if ((Renderer.zoom >= 15) && !bstr.isEmpty()) {
66 Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40),Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -30)));
67 }
68 }
69
70 public static void radioStations(Feature feature) {
71 Renderer.symbol(feature, Beacons.RadarStation);
72 ArrayList<CatROS> cats = (ArrayList<CatROS>)Rules.getAttVal(feature, Obj.RDOSTA, 0, Att.CATROS);
73 boolean vais = false;
74 String bstr = "";
75 for (CatROS ros : cats) {
76 switch (ros) {
77 case ROS_OMNI:
78 bstr += " RC";
79 break;
80 case ROS_DIRL:
81 bstr += " RD";
82 break;
83 case ROS_ROTP:
84 bstr += " RW";
85 break;
86 case ROS_CNSL:
87 bstr += " Consol";
88 break;
89 case ROS_RDF:
90 bstr += " RG";
91 break;
92 case ROS_QTA:
93 bstr += " R";
94 break;
95 case ROS_AERO:
96 bstr += " AeroRC";
97 break;
98 case ROS_DECA:
99 bstr += " Decca";
100 break;
101 case ROS_LORN:
102 bstr += " Loran";
103 break;
104 case ROS_DGPS:
105 bstr += " DGPS";
106 break;
107 case ROS_TORN:
108 bstr += " Toran";
109 break;
110 case ROS_OMGA:
111 bstr += " Omega";
112 break;
113 case ROS_SYLD:
114 bstr += " Syledis";
115 break;
116 case ROS_CHKA:
117 bstr += " Chiaka";
118 break;
119 case ROS_PCOM:
120 case ROS_COMB:
121 case ROS_FACS:
122 case ROS_TIME:
123 break;
124 case ROS_PAIS:
125 case ROS_SAIS:
126 bstr += " AIS";
127 break;
128 case ROS_VAIS:
129 vais = true;
130 break;
131 case ROS_VANC:
132 vais = true;
133 Renderer.symbol(feature, Topmarks.TopNorth, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
134 break;
135 case ROS_VASC:
136 vais = true;
137 Renderer.symbol(feature, Topmarks.TopSouth, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
138 break;
139 case ROS_VAEC:
140 vais = true;
141 Renderer.symbol(feature, Topmarks.TopEast, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
142 break;
143 case ROS_VAWC:
144 vais = true;
145 Renderer.symbol(feature, Topmarks.TopWest, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
146 break;
147 case ROS_VAPL:
148 vais = true;
149 Renderer.symbol(feature, Topmarks.TopCan, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
150 break;
151 case ROS_VASL:
152 vais = true;
153 Renderer.symbol(feature, Topmarks.TopCone, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
154 break;
155 case ROS_VAID:
156 vais = true;
157 Renderer.symbol(feature, Topmarks.TopIsol, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
158 break;
159 case ROS_VASW:
160 vais = true;
161 Renderer.symbol(feature, Topmarks.TopSphere, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
162 break;
163 case ROS_VASP:
164 vais = true;
165 Renderer.symbol(feature, Topmarks.TopX, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
166 break;
167 case ROS_VAWK:
168 vais = true;
169 Renderer.symbol(feature, Topmarks.TopCross, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, -25)));
170 break;
171 default:
172 break;
173 }
174 }
175 if (Renderer.zoom >= 15) {
176 if (vais) {
177 Renderer.labelText(feature, "V-AIS", new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.BC, AffineTransform.getTranslateInstance(0, 70)));
178 }
179 if (!bstr.isEmpty()) {
180 Renderer.labelText(feature, bstr, new Font("Arial", Font.PLAIN, 40), Color.black, new Delta(Handle.BR, AffineTransform.getTranslateInstance(-30, -70)));
181 }
182 }
183 }
184
185 public static void lights(Feature feature) {
186
187 }
188
189 private static Point2D.Double radial(Snode centre, double radius, double angle) {
190 Point2D origin = Renderer.context.getPoint(centre);
191 double mile = Renderer.context.getPoint(Renderer.map.new Snode((centre.lat + Math.toRadians(1/60)), centre.lon)).getY() - origin.getY();
192 return new Point2D.Double(origin.getX() - (radius * mile * Math.sin(angle)), origin.getY() - (radius * mile * Math.cos(angle)));
193 }
194/*
195void renderFlare(Item_t *item) {
196 char *col = light_colours[COL_MAG];
197 Obj_t *obj = getObj(item, LIGHTS, 0);
198 Att_t *att;
199 if (((att = getAtt(obj, COLOUR)) != NULL) && (att->val.val.l->next == NULL)) {
200 col = light_colours[att->val.val.l->val];
201 }
202 renderSymbol(item, LIGHTS, "light", "", col, CC, 0, 0, 120);
203}
204
205void renderSector(Item_t *item, int s, char *text, char *style, double offset, int dy) {
206 Obj_t *sector;
207 double start, end;
208 Att_t *att;
209 XY_t p0, p1;
210 double r0, r1;
211 double b0, b1, span;
212 char *col;
213 XY_t pos = findCentroid(item);
214 if ((sector = getObj(item, LIGHTS, s)) != NULL) {
215 strcpy(string1, (att = getAtt(sector, LITRAD)) != NULL ? att->val.val.a : "0.2");
216 if (((att = getAtt(sector, CATLIT)) != NULL) && (testAtt(att, LIT_DIR)) && ((att = getAtt(sector, ORIENT)) != NULL)) {
217 b0 = fmod(540.0 - att->val.val.f, 360.0);
218 if ((att = getAtt(sector, COLOUR)) != NULL) {
219 col = light_colours[att->val.val.l->val];
220 r0 = atof(string1);
221 p0 = radial(pos, r0, b0);
222 printf("<path d=\"M %g,%g L %g,%g\" style=\"fill:none;stroke:#808080;stroke-width:%g;stroke-dasharray:%g\"/>\n",
223 pos.x, pos.y, p0.x, p0.y, (4 * symbolScale[zoom]), (20 * symbolScale[zoom]));
224 start = fmod(b0 + 2.0, 360.0);
225 end = fmod(360.0 + b0 - 2.0, 360.0);
226 Obj_t *adj;
227 for (int i = s-1; i <= s+1; i++) {
228 if (i == s) continue;
229 if ((adj = getObj(item, LIGHTS, i)) == NULL) continue;
230 Att_t *att;
231 if (((att = getAtt(adj, CATLIT)) != NULL) && (testAtt(att, LIT_DIR)) && ((att = getAtt(adj, ORIENT)) != NULL)) {
232 b1 = fmod(540.0 - att->val.val.f, 360.0);
233 if (fabs(b0 - b1) > 180.0) {
234 if (b0 < b1) b0 += 360.0;
235 else b1 += 360.0;
236 }
237 if (fabs(b0 - b1) < 4.0) {
238 if (b1 > b0) start = fmod((720.0 + b0 + b1) / 2.0, 360.0);
239 else end = fmod((720.0 + b0 + b1) / 2.0, 360.0);
240 }
241 }
242 }
243 p0 = radial(pos, r0, start);
244 p1 = radial(pos, r0, end);
245 printf("<path id=\"%d\" d=\"M %g,%g A %g,%g,0,0,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n",
246 ++ref, p0.x, p0.y, r0*mile, r0*mile, p1.x, p1.y, col, (20 * symbolScale[zoom]));
247 if (att->val.val.l->next != NULL) {
248 char *col = light_colours[att->val.val.l->next->val];
249 r1 = r0 - (20 * symbolScale[zoom]/mile);
250 p0 = radial(pos, r1, start);
251 p1 = radial(pos, r1, end);
252 printf("<path d=\"M %g,%g A %g,%g,0,0,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n",
253 p0.x, p0.y, r1*mile, r1*mile, p1.x, p1.y, col, (20 * symbolScale[zoom]));
254 }
255 }
256 } else if ((att = getAtt(sector, SECTR1)) != NULL) {
257 start = fmod(540.0 - att->val.val.f, 360.0);
258 if ((att = getAtt(sector, SECTR2)) != NULL) {
259 end = fmod(540.0 - att->val.val.f, 360.0);
260 start += start < end ? 360.0 : 0.0;
261 if ((att = getAtt(sector, COLOUR)) != NULL) {
262 char *ttok, *etok;
263 char *radstr = strdup(string1);
264 int arc = 0;
265 col = light_colours[att->val.val.l->val];
266 r0 = 0.0;
267 b0 = b1 = start;
268 for (char *tpl = strtok_r(radstr, ";", &ttok); tpl != NULL; tpl = strtok_r(NULL, ";", &ttok)) {
269 p0 = radial(pos, r0, b0);
270 span = 0.0;
271 char *ele = strtok_r(tpl, ":", &etok);
272 if ((*tpl == ':') && (r0 == 0.0)) {
273 r1 = 0.2;
274 } else if (*tpl != ':') {
275 r1 = atof(tpl);
276 ele = strtok_r(NULL, ":", &etok);
277 }
278 while (ele != NULL) {
279 if (isalpha(*ele)) {
280 if (strcmp(ele, "suppress") == 0) arc = 2;
281 else if (strcmp(ele, "dashed") == 0) arc = 1;
282 else arc = 0;
283 } else {
284 span = atof(ele);
285 }
286 ele = strtok_r(NULL, ":", &etok);
287 }
288 if (span == 0.0) {
289 char *back = (ttok != NULL) ? strstr(ttok, "-") : NULL;
290 if (back != NULL) {
291 span = b0 - end + atof(back);
292 } else {
293 span = b0 - end;
294 }
295 }
296 if (r1 != r0) {
297 p1 = radial(pos, r1, b0);
298 if (!((start == 180.0) && (end == 180.0)))
299 printf("<path d=\"M %g,%g L %g,%g\" style=\"fill:none;stroke:#808080;stroke-width:%g;stroke-dasharray:%g\"/>\n",
300 p0.x, p0.y, p1.x, p1.y, (4 * symbolScale[zoom]), (20 * symbolScale[zoom]));
301 r0 = r1;
302 p0 = p1;
303 }
304 if (span < 0.0) {
305 b1 = end - span;
306 b1 = b1 > b0 ? b0 : b1;
307 b0 = b1;
308 b1 = end;
309 p0 = radial(pos, r0, b0);
310 } else {
311 b1 = b0 - span;
312 b1 = b1 < end ? end : b1;
313 }
314 p1 = radial(pos, r1, b1);
315 if ((b0 == 180.0) && (b1 == 180.0)) {
316 span = 360.0;
317 p1 = radial(pos, r1, b1+0.01);
318 }
319 if (arc == 0) {
320 if (p0.x < p1.x)
321 printf("<path id=\"%d\" d=\"M %g,%g A %g,%g,0,%d,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n",
322 ++ref, p0.x, p0.y, r1*mile, r1*mile, span>180.0, p1.x, p1.y, col, (20 * symbolScale[zoom]));
323 else
324 printf("<path id=\"%d\" d=\"M %g,%g A %g,%g,0,%d,0,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n",
325 ++ref, p1.x, p1.y, r1*mile, r1*mile, span>180.0, p0.x, p0.y, col, (20 * symbolScale[zoom]));
326 if (text != NULL) {
327 double chord = sqrt(pow((p0.x - p1.x), 2) + pow((p0.y - p1.y), 2));
328 if ((chord > (strlen(text) * textScale[zoom] * 50)) || ((b0 == 180.0) && (b1 == 180.0)))
329 drawLineText(item, text, style, offset, dy, ref);
330 }
331 } else if (arc == 1) {
332 printf("<path d=\"M %g,%g A %g,%g,0,%d,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g;stroke-opacity:0.5;stroke-dasharray:%g\"/>\n",
333 p0.x, p0.y, r1*mile, r1*mile, span>180.0, p1.x, p1.y, col, (10 * symbolScale[zoom]), (30 * symbolScale[zoom]));
334 }
335 if ((arc == 0) && (att->val.val.l->next != NULL)) {
336 char *col = light_colours[att->val.val.l->next->val];
337 double r2 = r1 - (20 * symbolScale[zoom]/mile);
338 XY_t p2 = radial(pos, r2, b0);
339 XY_t p3 = radial(pos, r2, b1);
340 printf("<path d=\"M %g,%g A %g,%g,0,%d,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n",
341 p2.x, p2.y, r1*mile, r1*mile, span>180.0, p3.x, p3.y, col, (20 * symbolScale[zoom]));
342 }
343 b0 = b1;
344 if (b0 == end) break;
345 }
346 if (!((start == 180.0) && (end == 180.0)))
347 printf("<path d=\"M %g,%g L %g,%g\" style=\"fill:none;stroke:#808080;stroke-width:%g;stroke-dasharray:%g\"/>\n",
348 pos.x, pos.y, p1.x, p1.y, (4 * symbolScale[zoom]), (20 * symbolScale[zoom]));
349 free(radstr);
350 }
351 }
352 }
353 }
354}
355char *charString(Item_t *item, char *type, int idx) {
356 strcpy(string1, "");
357 Att_t *att = NULL;
358 Obj_t *obj = getObj(item, enumType(type), idx);
359 switch (enumType(type)) {
360 case CGUSTA:
361 strcpy(string1, "CG");
362 if ((obj != NULL) && (att = getAtt(obj, COMCHA)) != NULL)
363 sprintf(strchr(string1, 0), " Ch.%s", stringValue(att->val));
364 break;
365 case FOGSIG:
366 if (obj != NULL) {
367 if ((att = getAtt(obj, CATFOG)) != NULL)
368 strcat(string1, fog_signals[att->val.val.e]);
369 if ((att = getAtt(obj, SIGGRP)) != NULL)
370 sprintf(strchr(string1, 0), "(%s)", stringValue(att->val));
371 else
372 strcat(string1, " ");
373 if ((att = getAtt(obj, SIGPER)) != NULL)
374 sprintf(strchr(string1, 0), "%ss ", stringValue(att->val));
375 if ((att = getAtt(obj, VALMXR)) != NULL)
376 sprintf(strchr(string1, 0), "%sM", stringValue(att->val));
377 }
378 break;
379 case SISTAT:
380 strcpy(string1, "SS");
381 if (obj != NULL) {
382 if ((att = getAtt(obj, CATSIT)) != NULL)
383 strcat(string1, sit_map[att->val.val.l->val]);
384 if ((att = getAtt(obj, COMCHA)) != NULL)
385 sprintf(strchr(string1, 0), "\nCh.%s", stringValue(att->val));
386 }
387 break;
388 case SISTAW:
389 strcpy(string1, "SS");
390 if (obj != NULL) {
391 if ((att = getAtt(obj, CATSIW)) != NULL)
392 strcat(string1, siw_map[att->val.val.l->val]);
393 if ((att = getAtt(obj, COMCHA)) != NULL)
394 sprintf(strchr(string1, 0), "\nCh.%s", stringValue(att->val));
395 }
396 break;
397 case LIGHTS:
398 {
399 int secmax = countObjects(item, "light");
400 if ((idx == 0) && (secmax > 0)) {
401 struct SECT {
402 struct SECT *next;
403 int dir;
404 LitCHR_t chr;
405 ColCOL_t col;
406 ColCOL_t alt;
407 char *grp;
408 double per;
409 double rng;
410 } *lights = NULL;
411 for (int i = secmax; i > 0; i--) {
412 struct SECT *tmp = calloc(1, sizeof(struct SECT));
413 tmp->next = lights;
414 lights = tmp;
415 obj = getObj(item, LIGHTS, i);
416 if ((att = getAtt(obj, CATLIT)) != NULL) {
417 lights->dir = testAtt(att, LIT_DIR);
418 }
419 if ((att = getAtt(obj, LITCHR)) != NULL) {
420 lights->chr = att->val.val.e;
421 switch (lights->chr) {
422 case CHR_AL:
423 lights->chr = CHR_F;
424 break;
425 case CHR_ALOC:
426 lights->chr = CHR_OC;
427 break;
428 case CHR_ALLFL:
429 lights->chr = CHR_LFL;
430 break;
431 case CHR_ALFL:
432 lights->chr = CHR_FL;
433 break;
434 case CHR_ALFFL:
435 lights->chr = CHR_FFL;
436 break;
437 default:
438 break;
439 }
440 }
441 if ((att = getAtt(obj, SIGGRP)) != NULL) {
442 lights->grp = att->val.val.a;
443 } else {
444 lights->grp = "";
445 }
446 if ((att = getAtt(obj, SIGPER)) != NULL) {
447 lights->per = att->val.val.f;
448 }
449 if ((att = getAtt(obj, VALNMR)) != NULL) {
450 lights->rng = att->val.val.f;
451 }
452 if ((att = getAtt(obj, COLOUR)) != NULL) {
453 lights->col = att->val.val.l->val;
454 if (att->val.val.l->next != NULL)
455 lights->alt = att->val.val.l->next->val;
456 }
457 }
458 struct COLRNG {
459 int col;
460 double rng;
461 } colrng[14];
462 while (lights != NULL) {
463 strcpy(string2, "");
464 bzero(colrng, 14*sizeof(struct COLRNG));
465 colrng[lights->col].col = 1;
466 colrng[lights->col].rng = lights->rng;
467 struct SECT *this = lights;
468 struct SECT *next = lights->next;
469 while (next != NULL) {
470 if ((this->dir == next->dir) && (this->chr == next->chr) &&
471 (strcmp(this->grp, next->grp) == 0) && (this->per == next->per)) {
472 colrng[next->col].col = 1;
473 if (next->rng > colrng[next->col].rng)
474 colrng[next->col].rng = next->rng;
475 struct SECT *tmp = lights;
476 while (tmp->next != next) tmp = tmp->next;
477 tmp->next = next->next;
478 free(next);
479 next = tmp->next;
480 } else {
481 next = next->next;
482 }
483 }
484 if (this->chr != CHR_UNKN) {
485 if (this->dir) strcpy(string2, "Dir.");
486 strcat(string2, light_characters[this->chr]);
487 if (strcmp(this->grp, "") != 0) {
488 if (this->grp[0] == '(')
489 sprintf(strchr(string2, 0), "%s", this->grp);
490 else
491 sprintf(strchr(string2, 0), "(%s)", this->grp);
492 } else {
493 if (strlen(string2) > 0) strcat(string2, ".");
494 }
495 int n = 0;
496 for (int i = 0; i < 14; i++) if (colrng[i].col) n++;
497 double max = 0.0;
498 for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng > max)) max = colrng[i].rng;
499 double min = max;
500 for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng > 0.0) && (colrng[i].rng < min)) min = colrng[i].rng;
501 if (min == max) {
502 for (int i = 0; i < 14; i++) if (colrng[i].col) strcat(string2, light_letters[i]);
503 } else {
504 for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng == max)) strcat(string2, light_letters[i]);
505 for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng < max) && (colrng[i].rng > min)) strcat(string2, light_letters[i]);
506 for (int i = 0; i < 14; i++) if (colrng[i].col && colrng[i].rng == min) strcat(string2, light_letters[i]);
507 }
508 strcat(string2, ".");
509 if (this->per > 0.0) sprintf(strchr(string2, 0), "%gs", this->per);
510 if (max > 0.0) {
511 sprintf(strchr(string2, 0), "%g", max);
512 if (min != max) {
513 if (n == 2) strcat(string2, "/");
514 else if (n > 2) strcat(string2, "-");
515 if (min < max) sprintf(strchr(string2, 0), "%g", min);
516 }
517 strcat(string2, "M");
518 }
519 if (strlen(string1) > 0) strcat(string1, "\n");
520 strcat(string1, string2);
521 }
522 lights = this->next;
523 free(this);
524 this = lights;
525 }
526 } else {
527 if ((att = getAtt(obj, CATLIT)) != NULL) {
528 if (testAtt(att, LIT_DIR))
529 strcat(string1, "Dir");
530 }
531 if ((att = getAtt(obj, MLTYLT)) != NULL)
532 sprintf(strchr(string1, 0), "%s", stringValue(att->val));
533 if ((att = getAtt(obj, LITCHR)) != NULL) {
534 char *chrstr = strdup(stringValue(att->val));
535 Att_t *grp = getAtt(obj, SIGGRP);
536 if (grp != NULL) {
537 char *strgrp = strdup(stringValue(grp->val));
538 char *grpstr = strtok(strgrp, "()");
539 switch (att->val.val.e) {
540 case CHR_QLFL:
541 sprintf(strchr(string1, 0), "Q(%s)+LFl", grpstr);
542 break;
543 case CHR_VQLFL:
544 sprintf(strchr(string1, 0), "VQ(%s)+LFl", grpstr);
545 break;
546 case CHR_UQLFL:
547 sprintf(strchr(string1, 0), "UQ(%s)+LFl", grpstr);
548 break;
549 default:
550 sprintf(strchr(string1, 0), "%s(%s)", chrstr, grpstr);
551 break;
552 }
553 free(strgrp);
554 } else {
555 sprintf(strchr(string1, 0), "%s", chrstr);
556 }
557 free(chrstr);
558 }
559 if ((att = getAtt(obj, COLOUR)) != NULL) {
560 int n = countValues(att);
561 if (!((n == 1) && (idx == 0) && (testAtt(att, COL_WHT)))) {
562 if ((strlen(string1) > 0) && ((string1[strlen(string1)-1] != ')')))
563 strcat(string1, ".");
564 Lst_t *lst = att->val.val.l;
565 while (lst != NULL) {
566 strcat(string1, light_letters[lst->val]);
567 lst = lst->next;
568 }
569 }
570 }
571 if ((idx == 0) && (att = getAtt(obj, CATLIT)) != NULL) {
572 if (testAtt(att, LIT_VERT))
573 strcat(string1, "(vert)");
574 if (testAtt(att, LIT_HORI))
575 strcat(string1, "(hor)");
576 }
577 if ((strlen(string1) > 0) &&
578 ((getAtt(obj, SIGPER) != NULL) ||
579 (getAtt(obj, HEIGHT) != NULL) ||
580 (getAtt(obj, VALMXR) != NULL)) &&
581 (string1[strlen(string1)-1] != ')'))
582 strcat(string1, ".");
583 if ((att = getAtt(obj, SIGPER)) != NULL)
584 sprintf(strchr(string1, 0), "%ss", stringValue(att->val));
585 if ((idx == 0) && (item->objs.obj != LITMIN)) {
586 if ((att = getAtt(obj, HEIGHT)) != NULL)
587 sprintf(strchr(string1, 0), "%sm", stringValue(att->val));
588 if ((att = getAtt(obj, VALNMR)) != NULL)
589 sprintf(strchr(string1, 0), "%sM", stringValue(att->val));
590 }
591 if ((idx == 0) && (att = getAtt(obj, CATLIT)) != NULL) {
592 if (testAtt(att, LIT_FRNT))
593 strcat(string1, "(Front)");
594 if (testAtt(att, LIT_REAR))
595 strcat(string1, "(Rear)");
596 if (testAtt(att, LIT_UPPR))
597 strcat(string1, "(Upper)");
598 if (testAtt(att, LIT_LOWR))
599 strcat(string1, "(Lower)");
600 }
601 }
602 }
603 break;
604 default: break;
605 }
606 return string1;
607}
608*/
609
610}
Note: See TracBrowser for help on using the repository browser.