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 |
|
---|
10 | package seamap;
|
---|
11 |
|
---|
12 | import java.awt.geom.*;
|
---|
13 |
|
---|
14 | import seamap.SeaMap.*;
|
---|
15 |
|
---|
16 | public class Lights {
|
---|
17 |
|
---|
18 | private static Point2D.Double radial(Snode centre, double radius, double angle) {
|
---|
19 | Point2D origin = Renderer.context.getPoint(centre);
|
---|
20 | double mile = Renderer.context.getPoint(Renderer.map.new Snode((centre.lat + Math.toRadians(1/60)), centre.lon)).getY() - origin.getY();
|
---|
21 | return new Point2D.Double(origin.getX() - (radius * mile * Math.sin(angle)), origin.getY() - (radius * mile * Math.cos(angle)));
|
---|
22 | }
|
---|
23 | /*
|
---|
24 | void renderFlare(Item_t *item) {
|
---|
25 | char *col = light_colours[COL_MAG];
|
---|
26 | Obj_t *obj = getObj(item, LIGHTS, 0);
|
---|
27 | Att_t *att;
|
---|
28 | if (((att = getAtt(obj, COLOUR)) != NULL) && (att->val.val.l->next == NULL)) {
|
---|
29 | col = light_colours[att->val.val.l->val];
|
---|
30 | }
|
---|
31 | renderSymbol(item, LIGHTS, "light", "", col, CC, 0, 0, 120);
|
---|
32 | }
|
---|
33 |
|
---|
34 | void renderSector(Item_t *item, int s, char *text, char *style, double offset, int dy) {
|
---|
35 | Obj_t *sector;
|
---|
36 | double start, end;
|
---|
37 | Att_t *att;
|
---|
38 | XY_t p0, p1;
|
---|
39 | double r0, r1;
|
---|
40 | double b0, b1, span;
|
---|
41 | char *col;
|
---|
42 | XY_t pos = findCentroid(item);
|
---|
43 | if ((sector = getObj(item, LIGHTS, s)) != NULL) {
|
---|
44 | strcpy(string1, (att = getAtt(sector, LITRAD)) != NULL ? att->val.val.a : "0.2");
|
---|
45 | if (((att = getAtt(sector, CATLIT)) != NULL) && (testAtt(att, LIT_DIR)) && ((att = getAtt(sector, ORIENT)) != NULL)) {
|
---|
46 | b0 = fmod(540.0 - att->val.val.f, 360.0);
|
---|
47 | if ((att = getAtt(sector, COLOUR)) != NULL) {
|
---|
48 | col = light_colours[att->val.val.l->val];
|
---|
49 | r0 = atof(string1);
|
---|
50 | p0 = radial(pos, r0, b0);
|
---|
51 | printf("<path d=\"M %g,%g L %g,%g\" style=\"fill:none;stroke:#808080;stroke-width:%g;stroke-dasharray:%g\"/>\n",
|
---|
52 | pos.x, pos.y, p0.x, p0.y, (4 * symbolScale[zoom]), (20 * symbolScale[zoom]));
|
---|
53 | start = fmod(b0 + 2.0, 360.0);
|
---|
54 | end = fmod(360.0 + b0 - 2.0, 360.0);
|
---|
55 | Obj_t *adj;
|
---|
56 | for (int i = s-1; i <= s+1; i++) {
|
---|
57 | if (i == s) continue;
|
---|
58 | if ((adj = getObj(item, LIGHTS, i)) == NULL) continue;
|
---|
59 | Att_t *att;
|
---|
60 | if (((att = getAtt(adj, CATLIT)) != NULL) && (testAtt(att, LIT_DIR)) && ((att = getAtt(adj, ORIENT)) != NULL)) {
|
---|
61 | b1 = fmod(540.0 - att->val.val.f, 360.0);
|
---|
62 | if (fabs(b0 - b1) > 180.0) {
|
---|
63 | if (b0 < b1) b0 += 360.0;
|
---|
64 | else b1 += 360.0;
|
---|
65 | }
|
---|
66 | if (fabs(b0 - b1) < 4.0) {
|
---|
67 | if (b1 > b0) start = fmod((720.0 + b0 + b1) / 2.0, 360.0);
|
---|
68 | else end = fmod((720.0 + b0 + b1) / 2.0, 360.0);
|
---|
69 | }
|
---|
70 | }
|
---|
71 | }
|
---|
72 | p0 = radial(pos, r0, start);
|
---|
73 | p1 = radial(pos, r0, end);
|
---|
74 | 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",
|
---|
75 | ++ref, p0.x, p0.y, r0*mile, r0*mile, p1.x, p1.y, col, (20 * symbolScale[zoom]));
|
---|
76 | if (att->val.val.l->next != NULL) {
|
---|
77 | char *col = light_colours[att->val.val.l->next->val];
|
---|
78 | r1 = r0 - (20 * symbolScale[zoom]/mile);
|
---|
79 | p0 = radial(pos, r1, start);
|
---|
80 | p1 = radial(pos, r1, end);
|
---|
81 | printf("<path d=\"M %g,%g A %g,%g,0,0,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n",
|
---|
82 | p0.x, p0.y, r1*mile, r1*mile, p1.x, p1.y, col, (20 * symbolScale[zoom]));
|
---|
83 | }
|
---|
84 | }
|
---|
85 | } else if ((att = getAtt(sector, SECTR1)) != NULL) {
|
---|
86 | start = fmod(540.0 - att->val.val.f, 360.0);
|
---|
87 | if ((att = getAtt(sector, SECTR2)) != NULL) {
|
---|
88 | end = fmod(540.0 - att->val.val.f, 360.0);
|
---|
89 | start += start < end ? 360.0 : 0.0;
|
---|
90 | if ((att = getAtt(sector, COLOUR)) != NULL) {
|
---|
91 | char *ttok, *etok;
|
---|
92 | char *radstr = strdup(string1);
|
---|
93 | int arc = 0;
|
---|
94 | col = light_colours[att->val.val.l->val];
|
---|
95 | r0 = 0.0;
|
---|
96 | b0 = b1 = start;
|
---|
97 | for (char *tpl = strtok_r(radstr, ";", &ttok); tpl != NULL; tpl = strtok_r(NULL, ";", &ttok)) {
|
---|
98 | p0 = radial(pos, r0, b0);
|
---|
99 | span = 0.0;
|
---|
100 | char *ele = strtok_r(tpl, ":", &etok);
|
---|
101 | if ((*tpl == ':') && (r0 == 0.0)) {
|
---|
102 | r1 = 0.2;
|
---|
103 | } else if (*tpl != ':') {
|
---|
104 | r1 = atof(tpl);
|
---|
105 | ele = strtok_r(NULL, ":", &etok);
|
---|
106 | }
|
---|
107 | while (ele != NULL) {
|
---|
108 | if (isalpha(*ele)) {
|
---|
109 | if (strcmp(ele, "suppress") == 0) arc = 2;
|
---|
110 | else if (strcmp(ele, "dashed") == 0) arc = 1;
|
---|
111 | else arc = 0;
|
---|
112 | } else {
|
---|
113 | span = atof(ele);
|
---|
114 | }
|
---|
115 | ele = strtok_r(NULL, ":", &etok);
|
---|
116 | }
|
---|
117 | if (span == 0.0) {
|
---|
118 | char *back = (ttok != NULL) ? strstr(ttok, "-") : NULL;
|
---|
119 | if (back != NULL) {
|
---|
120 | span = b0 - end + atof(back);
|
---|
121 | } else {
|
---|
122 | span = b0 - end;
|
---|
123 | }
|
---|
124 | }
|
---|
125 | if (r1 != r0) {
|
---|
126 | p1 = radial(pos, r1, b0);
|
---|
127 | if (!((start == 180.0) && (end == 180.0)))
|
---|
128 | printf("<path d=\"M %g,%g L %g,%g\" style=\"fill:none;stroke:#808080;stroke-width:%g;stroke-dasharray:%g\"/>\n",
|
---|
129 | p0.x, p0.y, p1.x, p1.y, (4 * symbolScale[zoom]), (20 * symbolScale[zoom]));
|
---|
130 | r0 = r1;
|
---|
131 | p0 = p1;
|
---|
132 | }
|
---|
133 | if (span < 0.0) {
|
---|
134 | b1 = end - span;
|
---|
135 | b1 = b1 > b0 ? b0 : b1;
|
---|
136 | b0 = b1;
|
---|
137 | b1 = end;
|
---|
138 | p0 = radial(pos, r0, b0);
|
---|
139 | } else {
|
---|
140 | b1 = b0 - span;
|
---|
141 | b1 = b1 < end ? end : b1;
|
---|
142 | }
|
---|
143 | p1 = radial(pos, r1, b1);
|
---|
144 | if ((b0 == 180.0) && (b1 == 180.0)) {
|
---|
145 | span = 360.0;
|
---|
146 | p1 = radial(pos, r1, b1+0.01);
|
---|
147 | }
|
---|
148 | if (arc == 0) {
|
---|
149 | if (p0.x < p1.x)
|
---|
150 | 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",
|
---|
151 | ++ref, p0.x, p0.y, r1*mile, r1*mile, span>180.0, p1.x, p1.y, col, (20 * symbolScale[zoom]));
|
---|
152 | else
|
---|
153 | 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",
|
---|
154 | ++ref, p1.x, p1.y, r1*mile, r1*mile, span>180.0, p0.x, p0.y, col, (20 * symbolScale[zoom]));
|
---|
155 | if (text != NULL) {
|
---|
156 | double chord = sqrt(pow((p0.x - p1.x), 2) + pow((p0.y - p1.y), 2));
|
---|
157 | if ((chord > (strlen(text) * textScale[zoom] * 50)) || ((b0 == 180.0) && (b1 == 180.0)))
|
---|
158 | drawLineText(item, text, style, offset, dy, ref);
|
---|
159 | }
|
---|
160 | } else if (arc == 1) {
|
---|
161 | 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",
|
---|
162 | p0.x, p0.y, r1*mile, r1*mile, span>180.0, p1.x, p1.y, col, (10 * symbolScale[zoom]), (30 * symbolScale[zoom]));
|
---|
163 | }
|
---|
164 | if ((arc == 0) && (att->val.val.l->next != NULL)) {
|
---|
165 | char *col = light_colours[att->val.val.l->next->val];
|
---|
166 | double r2 = r1 - (20 * symbolScale[zoom]/mile);
|
---|
167 | XY_t p2 = radial(pos, r2, b0);
|
---|
168 | XY_t p3 = radial(pos, r2, b1);
|
---|
169 | printf("<path d=\"M %g,%g A %g,%g,0,%d,1,%g,%g\" style=\"fill:none;stroke:%s;stroke-width:%g\"/>\n",
|
---|
170 | p2.x, p2.y, r1*mile, r1*mile, span>180.0, p3.x, p3.y, col, (20 * symbolScale[zoom]));
|
---|
171 | }
|
---|
172 | b0 = b1;
|
---|
173 | if (b0 == end) break;
|
---|
174 | }
|
---|
175 | if (!((start == 180.0) && (end == 180.0)))
|
---|
176 | printf("<path d=\"M %g,%g L %g,%g\" style=\"fill:none;stroke:#808080;stroke-width:%g;stroke-dasharray:%g\"/>\n",
|
---|
177 | pos.x, pos.y, p1.x, p1.y, (4 * symbolScale[zoom]), (20 * symbolScale[zoom]));
|
---|
178 | free(radstr);
|
---|
179 | }
|
---|
180 | }
|
---|
181 | }
|
---|
182 | }
|
---|
183 | }
|
---|
184 | char *charString(Item_t *item, char *type, int idx) {
|
---|
185 | strcpy(string1, "");
|
---|
186 | Att_t *att = NULL;
|
---|
187 | Obj_t *obj = getObj(item, enumType(type), idx);
|
---|
188 | switch (enumType(type)) {
|
---|
189 | case CGUSTA:
|
---|
190 | strcpy(string1, "CG");
|
---|
191 | if ((obj != NULL) && (att = getAtt(obj, COMCHA)) != NULL)
|
---|
192 | sprintf(strchr(string1, 0), " Ch.%s", stringValue(att->val));
|
---|
193 | break;
|
---|
194 | case FOGSIG:
|
---|
195 | if (obj != NULL) {
|
---|
196 | if ((att = getAtt(obj, CATFOG)) != NULL)
|
---|
197 | strcat(string1, fog_signals[att->val.val.e]);
|
---|
198 | if ((att = getAtt(obj, SIGGRP)) != NULL)
|
---|
199 | sprintf(strchr(string1, 0), "(%s)", stringValue(att->val));
|
---|
200 | else
|
---|
201 | strcat(string1, " ");
|
---|
202 | if ((att = getAtt(obj, SIGPER)) != NULL)
|
---|
203 | sprintf(strchr(string1, 0), "%ss ", stringValue(att->val));
|
---|
204 | if ((att = getAtt(obj, VALMXR)) != NULL)
|
---|
205 | sprintf(strchr(string1, 0), "%sM", stringValue(att->val));
|
---|
206 | }
|
---|
207 | break;
|
---|
208 | case RTPBCN:
|
---|
209 | if (obj != NULL) {
|
---|
210 | if ((att = getAtt(obj, CATRTB)) != NULL)
|
---|
211 | strcat(string1, rtb_map[att->val.val.e]);
|
---|
212 | if ((att = getAtt(obj, SIGGRP)) != NULL)
|
---|
213 | sprintf(strchr(string1, 0), "(%s)", stringValue(att->val));
|
---|
214 | else
|
---|
215 | strcat(string1, " ");
|
---|
216 | if ((att = getAtt(obj, SIGPER)) != NULL)
|
---|
217 | sprintf(strchr(string1, 0), "%ss ", stringValue(att->val));
|
---|
218 | if ((att = getAtt(obj, VALMXR)) != NULL)
|
---|
219 | sprintf(strchr(string1, 0), "%sM", stringValue(att->val));
|
---|
220 | }
|
---|
221 | break;
|
---|
222 | case SISTAT:
|
---|
223 | strcpy(string1, "SS");
|
---|
224 | if (obj != NULL) {
|
---|
225 | if ((att = getAtt(obj, CATSIT)) != NULL)
|
---|
226 | strcat(string1, sit_map[att->val.val.l->val]);
|
---|
227 | if ((att = getAtt(obj, COMCHA)) != NULL)
|
---|
228 | sprintf(strchr(string1, 0), "\nCh.%s", stringValue(att->val));
|
---|
229 | }
|
---|
230 | break;
|
---|
231 | case SISTAW:
|
---|
232 | strcpy(string1, "SS");
|
---|
233 | if (obj != NULL) {
|
---|
234 | if ((att = getAtt(obj, CATSIW)) != NULL)
|
---|
235 | strcat(string1, siw_map[att->val.val.l->val]);
|
---|
236 | if ((att = getAtt(obj, COMCHA)) != NULL)
|
---|
237 | sprintf(strchr(string1, 0), "\nCh.%s", stringValue(att->val));
|
---|
238 | }
|
---|
239 | break;
|
---|
240 | case LIGHTS:
|
---|
241 | {
|
---|
242 | int secmax = countObjects(item, "light");
|
---|
243 | if ((idx == 0) && (secmax > 0)) {
|
---|
244 | struct SECT {
|
---|
245 | struct SECT *next;
|
---|
246 | int dir;
|
---|
247 | LitCHR_t chr;
|
---|
248 | ColCOL_t col;
|
---|
249 | ColCOL_t alt;
|
---|
250 | char *grp;
|
---|
251 | double per;
|
---|
252 | double rng;
|
---|
253 | } *lights = NULL;
|
---|
254 | for (int i = secmax; i > 0; i--) {
|
---|
255 | struct SECT *tmp = calloc(1, sizeof(struct SECT));
|
---|
256 | tmp->next = lights;
|
---|
257 | lights = tmp;
|
---|
258 | obj = getObj(item, LIGHTS, i);
|
---|
259 | if ((att = getAtt(obj, CATLIT)) != NULL) {
|
---|
260 | lights->dir = testAtt(att, LIT_DIR);
|
---|
261 | }
|
---|
262 | if ((att = getAtt(obj, LITCHR)) != NULL) {
|
---|
263 | lights->chr = att->val.val.e;
|
---|
264 | switch (lights->chr) {
|
---|
265 | case CHR_AL:
|
---|
266 | lights->chr = CHR_F;
|
---|
267 | break;
|
---|
268 | case CHR_ALOC:
|
---|
269 | lights->chr = CHR_OC;
|
---|
270 | break;
|
---|
271 | case CHR_ALLFL:
|
---|
272 | lights->chr = CHR_LFL;
|
---|
273 | break;
|
---|
274 | case CHR_ALFL:
|
---|
275 | lights->chr = CHR_FL;
|
---|
276 | break;
|
---|
277 | case CHR_ALFFL:
|
---|
278 | lights->chr = CHR_FFL;
|
---|
279 | break;
|
---|
280 | default:
|
---|
281 | break;
|
---|
282 | }
|
---|
283 | }
|
---|
284 | if ((att = getAtt(obj, SIGGRP)) != NULL) {
|
---|
285 | lights->grp = att->val.val.a;
|
---|
286 | } else {
|
---|
287 | lights->grp = "";
|
---|
288 | }
|
---|
289 | if ((att = getAtt(obj, SIGPER)) != NULL) {
|
---|
290 | lights->per = att->val.val.f;
|
---|
291 | }
|
---|
292 | if ((att = getAtt(obj, VALNMR)) != NULL) {
|
---|
293 | lights->rng = att->val.val.f;
|
---|
294 | }
|
---|
295 | if ((att = getAtt(obj, COLOUR)) != NULL) {
|
---|
296 | lights->col = att->val.val.l->val;
|
---|
297 | if (att->val.val.l->next != NULL)
|
---|
298 | lights->alt = att->val.val.l->next->val;
|
---|
299 | }
|
---|
300 | }
|
---|
301 | struct COLRNG {
|
---|
302 | int col;
|
---|
303 | double rng;
|
---|
304 | } colrng[14];
|
---|
305 | while (lights != NULL) {
|
---|
306 | strcpy(string2, "");
|
---|
307 | bzero(colrng, 14*sizeof(struct COLRNG));
|
---|
308 | colrng[lights->col].col = 1;
|
---|
309 | colrng[lights->col].rng = lights->rng;
|
---|
310 | struct SECT *this = lights;
|
---|
311 | struct SECT *next = lights->next;
|
---|
312 | while (next != NULL) {
|
---|
313 | if ((this->dir == next->dir) && (this->chr == next->chr) &&
|
---|
314 | (strcmp(this->grp, next->grp) == 0) && (this->per == next->per)) {
|
---|
315 | colrng[next->col].col = 1;
|
---|
316 | if (next->rng > colrng[next->col].rng)
|
---|
317 | colrng[next->col].rng = next->rng;
|
---|
318 | struct SECT *tmp = lights;
|
---|
319 | while (tmp->next != next) tmp = tmp->next;
|
---|
320 | tmp->next = next->next;
|
---|
321 | free(next);
|
---|
322 | next = tmp->next;
|
---|
323 | } else {
|
---|
324 | next = next->next;
|
---|
325 | }
|
---|
326 | }
|
---|
327 | if (this->chr != CHR_UNKN) {
|
---|
328 | if (this->dir) strcpy(string2, "Dir.");
|
---|
329 | strcat(string2, light_characters[this->chr]);
|
---|
330 | if (strcmp(this->grp, "") != 0) {
|
---|
331 | if (this->grp[0] == '(')
|
---|
332 | sprintf(strchr(string2, 0), "%s", this->grp);
|
---|
333 | else
|
---|
334 | sprintf(strchr(string2, 0), "(%s)", this->grp);
|
---|
335 | } else {
|
---|
336 | if (strlen(string2) > 0) strcat(string2, ".");
|
---|
337 | }
|
---|
338 | int n = 0;
|
---|
339 | for (int i = 0; i < 14; i++) if (colrng[i].col) n++;
|
---|
340 | double max = 0.0;
|
---|
341 | for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng > max)) max = colrng[i].rng;
|
---|
342 | double min = max;
|
---|
343 | for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng > 0.0) && (colrng[i].rng < min)) min = colrng[i].rng;
|
---|
344 | if (min == max) {
|
---|
345 | for (int i = 0; i < 14; i++) if (colrng[i].col) strcat(string2, light_letters[i]);
|
---|
346 | } else {
|
---|
347 | for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng == max)) strcat(string2, light_letters[i]);
|
---|
348 | for (int i = 0; i < 14; i++) if (colrng[i].col && (colrng[i].rng < max) && (colrng[i].rng > min)) strcat(string2, light_letters[i]);
|
---|
349 | for (int i = 0; i < 14; i++) if (colrng[i].col && colrng[i].rng == min) strcat(string2, light_letters[i]);
|
---|
350 | }
|
---|
351 | strcat(string2, ".");
|
---|
352 | if (this->per > 0.0) sprintf(strchr(string2, 0), "%gs", this->per);
|
---|
353 | if (max > 0.0) {
|
---|
354 | sprintf(strchr(string2, 0), "%g", max);
|
---|
355 | if (min != max) {
|
---|
356 | if (n == 2) strcat(string2, "/");
|
---|
357 | else if (n > 2) strcat(string2, "-");
|
---|
358 | if (min < max) sprintf(strchr(string2, 0), "%g", min);
|
---|
359 | }
|
---|
360 | strcat(string2, "M");
|
---|
361 | }
|
---|
362 | if (strlen(string1) > 0) strcat(string1, "\n");
|
---|
363 | strcat(string1, string2);
|
---|
364 | }
|
---|
365 | lights = this->next;
|
---|
366 | free(this);
|
---|
367 | this = lights;
|
---|
368 | }
|
---|
369 | } else {
|
---|
370 | if ((att = getAtt(obj, CATLIT)) != NULL) {
|
---|
371 | if (testAtt(att, LIT_DIR))
|
---|
372 | strcat(string1, "Dir");
|
---|
373 | }
|
---|
374 | if ((att = getAtt(obj, MLTYLT)) != NULL)
|
---|
375 | sprintf(strchr(string1, 0), "%s", stringValue(att->val));
|
---|
376 | if ((att = getAtt(obj, LITCHR)) != NULL) {
|
---|
377 | char *chrstr = strdup(stringValue(att->val));
|
---|
378 | Att_t *grp = getAtt(obj, SIGGRP);
|
---|
379 | if (grp != NULL) {
|
---|
380 | char *strgrp = strdup(stringValue(grp->val));
|
---|
381 | char *grpstr = strtok(strgrp, "()");
|
---|
382 | switch (att->val.val.e) {
|
---|
383 | case CHR_QLFL:
|
---|
384 | sprintf(strchr(string1, 0), "Q(%s)+LFl", grpstr);
|
---|
385 | break;
|
---|
386 | case CHR_VQLFL:
|
---|
387 | sprintf(strchr(string1, 0), "VQ(%s)+LFl", grpstr);
|
---|
388 | break;
|
---|
389 | case CHR_UQLFL:
|
---|
390 | sprintf(strchr(string1, 0), "UQ(%s)+LFl", grpstr);
|
---|
391 | break;
|
---|
392 | default:
|
---|
393 | sprintf(strchr(string1, 0), "%s(%s)", chrstr, grpstr);
|
---|
394 | break;
|
---|
395 | }
|
---|
396 | free(strgrp);
|
---|
397 | } else {
|
---|
398 | sprintf(strchr(string1, 0), "%s", chrstr);
|
---|
399 | }
|
---|
400 | free(chrstr);
|
---|
401 | }
|
---|
402 | if ((att = getAtt(obj, COLOUR)) != NULL) {
|
---|
403 | int n = countValues(att);
|
---|
404 | if (!((n == 1) && (idx == 0) && (testAtt(att, COL_WHT)))) {
|
---|
405 | if ((strlen(string1) > 0) && ((string1[strlen(string1)-1] != ')')))
|
---|
406 | strcat(string1, ".");
|
---|
407 | Lst_t *lst = att->val.val.l;
|
---|
408 | while (lst != NULL) {
|
---|
409 | strcat(string1, light_letters[lst->val]);
|
---|
410 | lst = lst->next;
|
---|
411 | }
|
---|
412 | }
|
---|
413 | }
|
---|
414 | if ((idx == 0) && (att = getAtt(obj, CATLIT)) != NULL) {
|
---|
415 | if (testAtt(att, LIT_VERT))
|
---|
416 | strcat(string1, "(vert)");
|
---|
417 | if (testAtt(att, LIT_HORI))
|
---|
418 | strcat(string1, "(hor)");
|
---|
419 | }
|
---|
420 | if ((strlen(string1) > 0) &&
|
---|
421 | ((getAtt(obj, SIGPER) != NULL) ||
|
---|
422 | (getAtt(obj, HEIGHT) != NULL) ||
|
---|
423 | (getAtt(obj, VALMXR) != NULL)) &&
|
---|
424 | (string1[strlen(string1)-1] != ')'))
|
---|
425 | strcat(string1, ".");
|
---|
426 | if ((att = getAtt(obj, SIGPER)) != NULL)
|
---|
427 | sprintf(strchr(string1, 0), "%ss", stringValue(att->val));
|
---|
428 | if ((idx == 0) && (item->objs.obj != LITMIN)) {
|
---|
429 | if ((att = getAtt(obj, HEIGHT)) != NULL)
|
---|
430 | sprintf(strchr(string1, 0), "%sm", stringValue(att->val));
|
---|
431 | if ((att = getAtt(obj, VALNMR)) != NULL)
|
---|
432 | sprintf(strchr(string1, 0), "%sM", stringValue(att->val));
|
---|
433 | }
|
---|
434 | if ((idx == 0) && (att = getAtt(obj, CATLIT)) != NULL) {
|
---|
435 | if (testAtt(att, LIT_FRNT))
|
---|
436 | strcat(string1, "(Front)");
|
---|
437 | if (testAtt(att, LIT_REAR))
|
---|
438 | strcat(string1, "(Rear)");
|
---|
439 | if (testAtt(att, LIT_UPPR))
|
---|
440 | strcat(string1, "(Upper)");
|
---|
441 | if (testAtt(att, LIT_LOWR))
|
---|
442 | strcat(string1, "(Lower)");
|
---|
443 | }
|
---|
444 | }
|
---|
445 | }
|
---|
446 | break;
|
---|
447 | default: break;
|
---|
448 | }
|
---|
449 | return string1;
|
---|
450 | }
|
---|
451 | */
|
---|
452 |
|
---|
453 | }
|
---|