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

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

save

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